Re: [PATCH][RFC] Lightweight user-level semaphores

From: Linus Torvalds (
Date: Mon Jan 07 2002 - 15:28:31 EST

On Mon, 7 Jan 2002, Matthew Kirkwood wrote:
> * It leaks. How were you going to refcount the kernel
> portions? Could they be attached to the VM mapping?
> Would a lockfs be too expensive?

Yes, I was going to just attach to the vma, along with potentially also
require a flag at mmap time (MAP_SEMAPHORE - some other unixes have
something like it already) to tell the OS about the consistency issues
that might come up on some architectures (on x86 it would be a no-op).

> * It doesn't have a timeout. Is there something like a
> down_timeout() available?

Not as-is, but all the kernel infrastructure should be there in theory.

> * I don't do the:
> if (kfs->user_address != fs)
> goto bad_sem;
> because it doesn't seem to add anything, and prevents
> putting these locks in a non-fixed file or SysV SHM
> map.

Fair enough. I think I suggested that just as another sanity check, and
because some architectures _will_ require address issues (not necessarily
total equality, but at least "modulo X equality").


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

This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:36 EST