[lkml]   [2002]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Lightweight userspace semaphores...
Linus Torvalds <> writes:

> On Mon, 25 Feb 2002, Rusty Russell wrote:
> >
> > Bugger. How about:
> >
> > sys_sem_area(void *pagestart, size_t len)
> > sys_unsem_area(void *pagestart, size_t len)
> >
> > Is that sufficient? Is sys_unsem_area required at all?
> The above is sufficient, but I would personally actually prefer an
> interface more like

Hmm. My preference is for something like
mprotect(start, len, PROT_SEM | PROT_READ | PROT_WRITE);

And then
mprotect ....
/* This architecture needs not special support skip the mprotect...

> fd = sem_initialize();
> mmap(fd, ...)
> ..
> munmap(..)
> which gives you a handle for the semaphore.


The common case for a decent lock is the uncontended case. In which
case you only need kernel support on demand. What you suggest would
create kernel data structures for all of the uncontended locks. That
sounds heavy. Especially as the memory on most architectures is already
safe to use for locks.

So if nothing else can we separate the two cases of having user space
memory safe for user space spin locks. And how to setup a wait queue
of user space waiters on when we need to wait?


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