Messages in this thread | | | Subject | Re: [PATCH v6 5/6] MCS Lock: Restructure the MCS lock defines and locking code into its own file | From | Jason Low <> | Date | Thu, 26 Sep 2013 23:26:54 -0700 |
| |
On Fri, 2013-09-27 at 08:02 +0200, Ingo Molnar wrote: > * Tim Chen <tim.c.chen@linux.intel.com> wrote: > > > > If we prefer to optimize this a bit though, perhaps we can first move > > > the node->lock = 0 so that it gets executed after the "if (likely(prev > > > == NULL)) {}" code block and then delete "node->lock = 1" inside the > > > code block. > > > > I suppose we can save one single assignment. The gain is probably not > > noticeable as once we set node->next to NULL, node->locked is likely in > > local cache line and the assignment operation is cheap. > > Would be nice to have this as a separate, add-on patch. Every single > instruction removal that has no downside is an upside! > > You can add a comment that explains it.
Yup, especially a spin lock (and one that I have found to be be used very frequently when running workloads on big machines).
| |