Re: [Patch] shm bug introduced with pagecache in 2.3.11

Alexander Viro (viro@math.psu.edu)
Fri, 19 Nov 1999 15:43:31 -0500 (EST)


On Fri, 19 Nov 1999, Linus Torvalds wrote:

>
>
> On Fri, 19 Nov 1999, Benjamin C.R. LaHaise wrote:
> >
> > Sure. Does the following sound?
> >
> > void down_read(struct rw_semaphore *sem);
> > void down_write(struct rw_semaphore *sem);
> > void up_read(struct rw_semaphore *sem);
> > void up_write(struct rw_semaphore *sem);
>
> Looks fine.
>
> > Looking at existing semaphores and rwlocks, it looks like a quick and
> > painless beast to create.
>
> Yeah, sure.
>
> Especially considering that the current semaphore code has been basically
> re-written three times to get it stable ;)
>
> But yes, mixing judicious amounts of the current semaphore code together
> with the rw-spinlock code should result in something working.
>
> "Just add brains".

IIRC, there was an implementation and analysis in Vahalia. Streamlining it
shouldn't be too hard (I have something like that in AFFS patches, but
there I didn't need {up,down}_write and did need upgrade/downgrade. IOW,
writrs always started as readers). IIRC, Vahalia uses two queues, counters
a-la rwlock_t has and counters of pending readers and writers. down_read()
blocks if there are pending writers and up_write() either wakes one writer
or (if ->writers==0) all pending readers.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/