]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
locking/percpu-rwsem: Replace waitqueue with rcuwait
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 11 Jan 2017 15:22:26 +0000 (07:22 -0800)
committerIngo Molnar <mingo@kernel.org>
Sat, 14 Jan 2017 10:14:35 +0000 (11:14 +0100)
commit52b94129f274937e4c25dd17b76697664a3c43c9
treeefcc4d7a0159e0bf33961532430e15b0ec66fcdb
parent8f95c90ceb541a38ac16fec48c05142ef1450c25
locking/percpu-rwsem: Replace waitqueue with rcuwait

The use of any kind of wait queue is an overkill for pcpu-rwsems.
While one option would be to use the less heavy simple (swait)
flavor, this is still too much for what pcpu-rwsems needs. For one,
we do not care about any sort of queuing in that the only (rare) time
writers (and readers, for that matter) are queued is when trying to
acquire the regular contended rw_sem. There cannot be any further
queuing as writers are serialized by the rw_sem in the first place.

Given that percpu_down_write() must not be called after exit_notify(),
we can replace the bulky waitqueue with rcuwait such that a writer
can wait for its turn to take the lock. As such, we can avoid the
queue handling and locking overhead.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave@stgolabs.net
Link: http://lkml.kernel.org/r/1484148146-14210-3-git-send-email-dave@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/percpu-rwsem.h
kernel/locking/percpu-rwsem.c