Messages in this thread | | | Subject | Re: [RFC][PATCH v2 5/5] mutex: Give spinners a chance to spin_on_owner if need_resched() triggered while queued | From | Jason Low <> | Date | Mon, 03 Feb 2014 23:13:12 -0800 |
| |
On Mon, 2014-02-03 at 20:25 +0100, Peter Zijlstra wrote:
> +void m_spin_unlock(struct m_spinlock **lock) > +{ > + struct m_spinlock *node = this_cpu_ptr(&m_node); > + struct m_spinlock *next; > + > + if (likely(cmpxchg(lock, node, NULL) == node)) > + return;
At this current point, (node->next != NULL) is a likely scenario. Perhaps we can also add the following code here:
next = xchg(&node->next, NULL); if (next) { ACCESS_ONCE(next->locked) = 1; return; }
> + next = m_spin_wait_next(lock, node, NULL); > + if (next) > + ACCESS_ONCE(next->locked) = 1; > +}
| |