powerpc/qspinlock: allow lock stealing in trylock and lock fastpath
authorNicholas Piggin <npiggin@gmail.com>
Sat, 26 Nov 2022 09:59:27 +0000 (19:59 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2022 06:48:50 +0000 (17:48 +1100)
commitf61ab43cc1a6146d6eef7e0713a452c3677ad13e
tree5c492373691342daebbb8422523b23aed23a3171
parentbe742c573fdafcfa1752642ca1c7aaf08c258128
powerpc/qspinlock: allow lock stealing in trylock and lock fastpath

This change allows trylock to steal the lock. It also allows the initial
lock attempt to steal the lock rather than bailing out and going to the
slow path.

This gives trylock more strength: without this a continually-contended
lock will never permit a trylock to succeed. With this change, the
trylock has a small but non-zero chance.

It also gives the lock fastpath most of the benefit of passing the
reservation back through to the steal loop in the slow path without the
complexity.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221126095932.1234527-13-npiggin@gmail.com
arch/powerpc/include/asm/qspinlock.h
arch/powerpc/lib/qspinlock.c