[lkml]   [2001]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] i386 rw_semaphores fix
Andrew Morton wrote:
> I think that's a very good approach. Sure, it's suboptimal when there
> are three or more waiters (and they're the right type and order). But
> that never happens. Nice design idea.


> These numbers are infinity :)

I know, but I think Linus may be happy with the resolution for the moment. It
can be extended later by siphoning off excess quantities of waiters into a
separate counter (as is done now) and by making the access count use a larger
part of the variable.

Unfortunately, managing the count and siphoned-off count together is tricky.

> You need sterner testing stuff :) I hit the BUG at the end of rwsem_wake()
> in about a second running rwsem-4. Removed the BUG and everything stops
> in D state.
> Grab rwsem-4 from
> ...

Will do.

> It's very simple. But running fully in-kernel shortens the
> code paths enormously and allows you to find those little
> timing windows.

I thought I'd got them all by using an activity counter incremented by both
read and write lockers.

> - rwsemdebug(FMT, ...) doesn't compile with egcs-1.1.2. Need
> to remove the comma.

This is tricky... you get all sorts of horrible warnings with gcc-2.96 if you
remove the comma. What I've done is now ANSI-C99 compliant, but egcs is not.

> - The comments in down_write and down_read() are inaccurate.
> RWSEM_ACTIVE_WRITE_BIAS is 0xffff0001, not 0x00010001


> - It won't compile when WAITQUEUE_DEBUG is turned on. I
> guess you knew that.

Currently putting in separate debugging stuff for rwsems.

> - The comments above the functions in semaphore.h need
> updating.

Done. (BTW in the latest patch, they're actually split out into separate
header files as per Linus's suggestion).

> - What on earth does __xg() do? (And why do people write
> code like that without explaining why? Don't answer this
> one).

Stolen from the xchg() macro/function, but I'm not sure what it does. Plus I
don't use it now.

> - Somewhat offtopic: the `asm' statements in semaphore.c
> are really dangerous.

Now all got .text in.

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:25    [W:0.326 / U:3.096 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site