From: David Howells <dhowells@redhat.com>
To: Vladislav Bolkhovitin <vst@vlnb.net>
Cc: dhowells@redhat.com, Al Viro <viro@ZenIV.linux.org.uk>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: Lockdep and rw_semaphores
Date: Tue, 13 Sep 2011 15:07:03 +0100 [thread overview]
Message-ID: <25976.1315922823@redhat.com> (raw)
In-Reply-To: <4E6EBDA8.2040401@vlnb.net>
Al is correct.
The in-kernel R/W semaphore implementation is written to be strictly fair. If
the semaphore is readlocked and a writer is pending, all further readers and
writers get added to the back of the FIFO queue, thus preventing writers from
being starved.
When it comes time to wake someone up, the waiter at the front of the queue is
woken. If that's a reader, then next on the queue may be woken up too if
that's also a reader - up to the point a writer is encountered. Any readers
beyond that writer in the queue have to wait for the writer in front of them
to get its share first.
David
prev parent reply other threads:[~2011-09-13 14:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-11 1:34 Lockdep and rw_semaphores Vladislav Bolkhovitin
2011-09-11 2:38 ` Al Viro
2011-09-13 2:19 ` Vladislav Bolkhovitin
2011-09-13 5:17 ` Al Viro
2011-09-14 1:55 ` Vladislav Bolkhovitin
2011-09-14 4:40 ` Al Viro
2011-09-15 2:16 ` Vladislav Bolkhovitin
2011-09-13 14:07 ` David Howells [this message]
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=25976.1315922823@redhat.com \
--to=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=viro@ZenIV.linux.org.uk \
--cc=vst@vlnb.net \
/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