Thread (39 messages) 39 messages, 5 authors, 2014-07-07

Re: [PATCH 07/11] qspinlock: Use a simple write to grab the lock, if applicable

From: Peter Zijlstra <peterz@infradead.org>
Date: 2014-07-07 14:52:07
Also in: kvm, linux-arch, lkml

On Wed, Jun 18, 2014 at 12:36:15PM -0400, Konrad Rzeszutek Wilk wrote:
On Sun, Jun 15, 2014 at 02:47:04PM +0200, Peter Zijlstra wrote:
quoted
From: Waiman Long <redacted>

Currently, atomic_cmpxchg() is used to get the lock. However, this is
not really necessary if there is more than one task in the queue and
the queue head don't need to reset the queue code word. For that case,
s/queue code word/tail {number,value}/ ?

quoted
a simple write to set the lock bit is enough as the queue head will
be the only one eligible to get the lock as long as it checks that
both the lock and pending bits are not set. The current pending bit
waiting code will ensure that the bit will not be set as soon as the
queue code word (tail) in the lock is set.
Just use the same word as above.
I made that:

Currently, atomic_cmpxchg() is used to get the lock. However, this is
not really necessary if there is more than one task in the queue and
the queue head doesn't need to reset the queue tail.

For that case, a simple write to set the lock byte is enough as the
queue head will be the only one eligible to get the lock as long as it
checks that both the lock and pending bits are not set. The current
pending bit waiting code will ensure that the bit will not be set as
soon as the queue tail is set.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help