public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hubertus Franke <frankeh@watson.ibm.com>
To: "Rusty Russell" <rusty@rustcorp.com.au>,
	"Peter Wächtler" <pwaechtler@loewe-komp.de>
Cc: arjanv@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: furwocks: Fast Userspace Read/Write Locks
Date: Mon, 11 Mar 2002 13:47:02 -0500	[thread overview]
Message-ID: <20020311184603.212393FE06@smtp.linux.ibm.com> (raw)
In-Reply-To: <E16jYor-0003Ty-00@wagner.rustcorp.com.au>
In-Reply-To: <E16jYor-0003Ty-00@wagner.rustcorp.com.au>

On Friday 08 March 2002 11:50 pm, Rusty Russell wrote:
> In message <3C888284.8030206@loewe-komp.de> you write:
> > Rusty Russell wrote:
> > > To clarify: I'd love this, but rwlocks in the kernel aren't even
> > > vaguely fair.  With a steady stream of overlapping readers, a writer
> > > will never get the lock.
> > >
> > > Hope that clarifies,
> >
> > But you talk about the current implementation, don't you?
> > Is there something to prevent an implementation of rwlocks in the
> > kernel, where a wrlock will lock (postponed) further rdlock requests?
>
> It's proven hard to do without performance impact.  Also, we can't do
> rw semaphores in a single word: you need two.
>
> Disproving me by implementation VERY welcome!
>
> Hope that helps,
> Rusty.

Well I did it with one word and cmpxchg and two queues in the kernel.
The two queues can be consolidated to one if the wait_element for the
queue has a third word, namely read or write.

Did you have a chance to think about the 
FUTEX_UP and FUTEX_UP_FAIR issue.
This should be simple enough as shown in the patch that pulled
your two approaches together. It doesn't seem to come at an
additional cost for the simple FUTEX_UP case.

I thought about it some more and talked to some other folks here.
One option is to wake up multiple ones as well to avoid starvation
and increase throughput.
E.g.    FUTEX_UP_SOME where you wake up #cpu tasks.
They would then go and contend for the lock again.

 
-- 
-- Hubertus Franke  (frankeh@watson.ibm.com)

  reply	other threads:[~2002-03-11 18:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-07 12:11 furwocks: Fast Userspace Read/Write Locks Rusty Russell
2002-03-07 12:40 ` Peter Wächtler
2002-03-07 14:41   ` Hubertus Franke
2002-03-07 12:50 ` Arjan van de Ven
2002-03-07 15:33   ` Hubertus Franke
2002-03-07 15:42     ` Arjan van de Ven
2002-03-07 19:11       ` Hubertus Franke
2002-03-07 20:17         ` H. Peter Anvin
2002-03-08  6:27           ` Rusty Russell
2002-03-08  6:29             ` H. Peter Anvin
2002-03-08  7:09               ` Rusty Russell
2002-03-08 19:32             ` Jamie Lokier
2002-03-08  1:22     ` Rusty Russell
2002-03-08  3:26       ` H. Peter Anvin
2002-03-08  9:21       ` Peter Wächtler
2002-03-08 18:13         ` Hubertus Franke
2002-03-09  4:50         ` Rusty Russell
2002-03-11 18:47           ` Hubertus Franke [this message]
2002-03-07 15:28 ` Hubertus Franke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020311184603.212393FE06@smtp.linux.ibm.com \
    --to=frankeh@watson.ibm.com \
    --cc=arjanv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pwaechtler@loewe-komp.de \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox