powerpc/qspinlock: allow new waiters to steal the lock before queueing
authorNicholas Piggin <npiggin@gmail.com>
Sat, 26 Nov 2022 09:59:19 +0000 (19:59 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2022 06:48:49 +0000 (17:48 +1100)
commit6aa42f883c438ea132a28801bef3f86f3883d14c
tree8bf1fe9cd361757f9d26659c364b9f1f72ed5821
parentb3a73b7db2b6cb3b2e5bfda5518a0e92230ef673
powerpc/qspinlock: allow new waiters to steal the lock before queueing

Allow new waiters to "steal" the lock before queueing. That is, to
acquire it while other CPUs have queued.

This particularly helps paravirt performance when physical CPUs are
oversubscribed, by keeping the lock from becoming a strict FIFO and
vCPU preemption causing queue train wrecks.

The new __queued_spin_trylock_steal() function is put in qspinlock.h
to save having to move it, because it will be used there by a later
change.

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