summaryrefslogtreecommitdiffstats
path: root/lib/list_debug.c
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 /lib/list_debug.c
parent345af7bf3304410634c21ada4664fda83d4d9a16 (diff)
downloadop-kernel-dev-70bdc6e0644f3535e93bac5c364ca199397e507e.zip
op-kernel-dev-70bdc6e0644f3535e93bac5c364ca199397e507e.tar.gz
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 'lib/list_debug.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud