lkml.org 
[lkml]   [2005]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/12]: MUTEX: Implement mutexes
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-19 16:51    [W:0.156 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site