Re: [PATCH] Lightweight userspace semaphores...

Rusty Russell (rusty@rustcorp.com.au)
Mon, 25 Feb 2002 10:29:39 +1100


In message <Pine.LNX.4.33.0202231551300.4173-100000@localhost.localdomain> you
write:
>
> On Sat, 23 Feb 2002, Rusty Russell wrote:
>
> > 1) Interface is: open /dev/usem, pread, pwrite.
>
> i like the patch, but the interface is ugly IMO. Why not new syscalls? I
> think these lightweight semaphores will become an important part of Linux,
> so having their own syscall entries is the most correct interface,
> something like:
>
> sys_sem_create()
> sys_sem_destroy()

There is no create and destroy (init is purely userspace). There is
"this is a semapore: up it". This is a feature.

> sys_sem_down()
> sys_sem_up()
>
> /dev/usem is such an ... ioctl()-ish approach. It's a scalability problem
> as well: read()/write() has (or can have) some implicit locking that is
> imposed on the usem interface as well.

Agreed with implicit locking: good catch. Disagree with neatness: I
like finding out in advance that there's no fast semaphore support.

> Plus sys_sem_create() should do some proper resource limit management,
> pinning down an unlimited number of pages is bad.

Since pages are pinned "on demand" and a process can only do one
syscall at a time, the maximum number of pinned pages per process ==
2. Which is fine.

Will do syscall version, and see if I can actually get it to beat
fcntl locking on reasonable benchmarks (ie. tdbtorture).

Cheers!
Rusty.
PS. Nomenclature: my fiance suggested FUS (Fast Userspace
Semaphores), and I am legally obliged to agree.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
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/