locking/mutex: Restructure wait loop
authorPeter Zijlstra <peterz@infradead.org>
Fri, 2 Sep 2016 11:42:12 +0000 (13:42 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 25 Oct 2016 09:31:53 +0000 (11:31 +0200)
commit5bbd7e644378334700889fb762d5893985a7311f
tree4de0e1d4dcb783e6cb86ba234ff79f85ffab18a7
parent9d659ae14b545c4296e812c70493bfdc999b5c1c
locking/mutex: Restructure wait loop

Doesn't really matter yet, but pull the HANDOFF and trylock out from
under the wait_lock.

The intention is to add an optimistic spin loop here, which requires
we do not hold the wait_lock, so shuffle code around in preparation.

Also clarify the purpose of taking the wait_lock in the wait loop, its
tempting to want to avoid it altogether, but the cancellation cases
need to to avoid losing wakeups.

Suggested-by: Waiman Long <waiman.long@hpe.com>
Tested-by: Jason Low <jason.low2@hpe.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
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: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/mutex.c