summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2010-08-09 17:21:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 20:45:10 -0700
commit70bdc6e0644f3535e93bac5c364ca199397e507e (patch)
treeaf5264cc57fcd69deae10fdd67cb62461111aa4c /init
parent345af7bf3304410634c21ada4664fda83d4d9a16 (diff)
downloadlinux-3.10-70bdc6e0644f3535e93bac5c364ca199397e507e.tar.gz
linux-3.10-70bdc6e0644f3535e93bac5c364ca199397e507e.tar.bz2
linux-3.10-70bdc6e0644f3535e93bac5c364ca199397e507e.zip
rwsem: lighter active count checks when waking up readers
In __rwsem_do_wake(), we can skip the active count check unless we come there from up_xxxx(). Also when checking the active count, it is not actually necessary to increment it; this allows us to get rid of the read side undo code and simplify the calculation of the final rwsem count adjustment once we've counted the reader threads to wake. The basic observation is the following. When there are waiter threads on a rwsem and the spinlock is held, other threads can only increment the active count by trying to grab the rwsem in down_xxxx(). However down_xxxx() will notice there are waiter threads and take the down_failed path, blocking to acquire the spinlock on the way there. Therefore, a thread observing an active count of zero with waiters queued and the spinlock held, is protected against other threads acquiring the rwsem until it wakes the last waiter or releases the spinlock. 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 'init')
0 files changed, 0 insertions, 0 deletions