powerpc/qspinlock: add mcs queueing for contended waiters
authorNicholas Piggin <npiggin@gmail.com>
Sat, 26 Nov 2022 09:59:16 +0000 (19:59 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2022 06:48:49 +0000 (17:48 +1100)
commit84990b169557428c318df87b7836cd15f65b62dc
tree10d588f9afda8aba2b8988f0a1533c726b3cbf5f
parent9f61521c7a284e799050cd2adacc9a611bd2b491
powerpc/qspinlock: add mcs queueing for contended waiters

This forms the basis of the qspinlock slow path.

Like generic qspinlocks and unlike the vanilla MCS algorithm, the lock
owner does not participate in the queue, only waiters. The first waiter
spins on the lock word, then when the lock is released it takes
ownership and unqueues the next waiter. This is how qspinlocks can be
implemented with the spinlock API -- lock owners don't need a node, only
waiters do.

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-2-npiggin@gmail.com
arch/powerpc/include/asm/qspinlock.h
arch/powerpc/include/asm/qspinlock_types.h
arch/powerpc/lib/qspinlock.c