On Mon, 19 Dec 2005, Matthew Wilcox wrote:

> On Mon, Dec 19, 2005 at 09:27:44AM +0000, Russell King wrote:
> > >   mov     r0, #1
> > >   swp     r1, r0, [%0]
> > >   cmp     r1, #0
> > >   bne     __contention
> 
> > That's over-simplified, and is the easy bit.  Now work out how you handle
> > the unlock operation.
> > 
> > You don't know whether the lock is contended or not in the unlock path,
> > so you always have to do the "wake up" thing.  (You can't rely on the
> > value of the lock since another thread may well be between this swp
> > instruction and entering the __contention function.  Hence you can't
> > use the value of the lock to determine whether there's anyone sleeping
> > on it.)
> 
> Here's a slightly less efficient way to determine if anyone else has
> swp'd behind your back (apologies if I get my ARM assembly wrong, it's
> been a few years):

No need to be less efficient.  See the mail I just sent with additional 
details.


Nicolas
-
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to