diff options
author | Michel Lespinasse <walken@google.com> | 2010-08-09 17:21:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 20:45:11 -0700 |
commit | 424acaaeb3a3932d64a9b4bd59df6cf72c22d8f3 (patch) | |
tree | c3c55028aa6eff578bc6d4d984796c7ea1379061 /lib/sha1.c | |
parent | fd41b33435ada87323cc86b50959fbffe35192c8 (diff) | |
download | lwn-424acaaeb3a3932d64a9b4bd59df6cf72c22d8f3.tar.gz lwn-424acaaeb3a3932d64a9b4bd59df6cf72c22d8f3.zip |
rwsem: wake queued readers when writer blocks on active read lock
This change addresses the following situation:
- Thread A acquires the rwsem for read
- Thread B tries to acquire the rwsem for write, notices there is already
an active owner for the rwsem.
- Thread C tries to acquire the rwsem for read, notices that thread B already
tried to acquire it.
- Thread C grabs the spinlock and queues itself on the wait queue.
- Thread B grabs the spinlock and queues itself behind C. At this point A is
the only remaining active owner on the rwsem.
In this situation thread B could notice that it was the last active writer
on the rwsem, and decide to wake C to let it proceed in parallel with A
since they both only want the rwsem for read.
Signed-off-by: Michel Lespinasse <walken@google.com>
Acked-by: David Howells <dhowells@redhat.com>
Cc: Mike Waychison <mikew@google.com>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Ying Han <yinghan@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/sha1.c')
0 files changed, 0 insertions, 0 deletions