Re: [PATCH 1/12]: MUTEX: Implement mutexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux