• Peter Zijlstra's avatar
    locking/mutex: Restructure wait loop · 5bbd7e64
    Peter Zijlstra authored
    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: default avatarWaiman Long <waiman.long@hpe.com>
    Tested-by: default avatarJason Low <jason.low2@hpe.com>
    Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@kernel.org>
    5bbd7e64
mutex.c 26.1 KB