Re: [PATCH] Lightweight userspace semaphores...

Hubertus Franke (frankeh@watson.ibm.com)
Wed, 27 Feb 2002 11:29:03 -0500


On Wed, Feb 27, 2002 at 11:24:17AM +1100, Rusty Russell wrote:
> On Mon, 25 Feb 2002 10:00:25 -0500
> Hubertus Franke <frankeh@watson.ibm.com> wrote:
>
> > Rusty, since I supplied one of those packages available under lse.sourceforge.net
> > let me make some comments.
> >
> > (a) why do you need to pin. I simply use the user level address (vaddr)
> > and hash with the <mm,vaddr> to obtain the internal object.
> > This also gives me full protection through the general vmm mechanisms.
>
> I pin while sleeping for convenience, so I can get a kernel address. It's
> only one page (maybe 2). I could look up the address every time, but then I
> need to swap the page back in anyway to look at it.

Lookup is cheap. I integrated a <hit meter> into my hashing mechanism
that reports the hits/misses and the average length of traversal down
a hash chain, it's insignificant for the cases I tried, but again
no big progam has be tried against any of these approaches.

I (think) I now also see the merit of your approach, in that you really don't
need to allocate a kernel object. You actually allocate the object
right into the shared user page and pin it down. Your argument is that
you only need to pin while somebody is sleeping on the lock.
Is that correct? Very tricky.
Let me also point out some shortcomings of this. If indeed there is a
shared page between user and kernel then how does the system react to
buggy userlevel code, e.g wild write that corrupt the wait queue.

In my explicite kernel object approach, I won't have this problem.

I hope I am not missing something here.

-- Hubertus
-
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/