Messages in this thread | | | Subject | Re: [PATCH] Lightweight userspace semaphores... | From | (Eric W. Biederman) | Date | 28 Feb 2002 21:56:45 -0700 |
| |
Linus Torvalds <torvalds@transmeta.com> 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 #ifdef PROT_SEM && PROT_SEM mprotect .... #else /* This architecture needs not special support skip the mprotect... #endif
> fd = sem_initialize(); > mmap(fd, ...) > .. > munmap(..) > > which gives you a handle for the semaphore.
Ouch.
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?
Eric
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |