[lkml]   [2002]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Fast Userspace Mutexes III.
On Wed, 6 Mar 2002 17:52:03 -0800
Richard Henderson <> wrote:

> On Mon, Mar 04, 2002 at 02:55:36PM +1100, Rusty Russell wrote:
> > + /* If we take the semaphore from 1 to 0, it's ours. */
> > + while (!atomic_dec_and_test(count)) {
> > + if (signal_pending(current)) {
> > + retval = -EINTR;
> > + break;
> This is not safe from wraparound. Let one thread hold the
> lock forever; let other threads keep trying to take the lock
> while periodically getting SIGALRM. Eventually one of the
> spinning threads will incorrectly acquire the mutex.

Yes, this was noted. And yes, it's about time we fixed sparc32
or threw it out of the tree. But since the real problem here is
"lock held forever", so I don't care.

> You really do need that cmpxchg loop.

Well, not decrementing if count < 0 already also works (as seen in
later patches), and I'm not going to break those SMP 386s if I don't
have to.

PS. Will Alpha have to do any special magic with the mmap PROT_SEM flag?
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.142 / U:14.848 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site