Skip to content

RFC locking: qspinlock

Peter Zijlstra linux-arch lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7qspinlock: Introducing a 4-byte queue spinlock implementationinclude/asm-generic/qspinlock.h include/asm-generic/qspinlock_types.h kernel/Kconfig.locks +3 more+377 -01 reply
2/7qspinlock, x86: Enable x86 to use queue spinlockarch/x86/Kconfig arch/x86/include/asm/qspinlock.h arch/x86/include/asm/spinlock.h +1 more+39 -00 replies
3/7qspinlock: Add pending bitinclude/asm-generic/qspinlock_types.h kernel/locking/qspinlock.c+87 -170 replies
4/7x86: Add atomic_test_and_set_bit()arch/x86/include/asm/atomic.h+13 -00 replies
5/7qspinlock: Optimize the pending caseinclude/asm-generic/qspinlock_types.h kernel/locking/qspinlock.c+36 -260 replies
6/7qspinlock: Optimize xchg_tailkernel/locking/qspinlock.c+65 -230 replies
7/7qspinlock: Optimize for smaller NR_CPUSinclude/asm-generic/qspinlock_types.h kernel/locking/qspinlock.c+98 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/7] locking: qspinlock

Hi Waiman,

I promised you this series a number of days ago; sorry for the delay I've been somewhat unwell :/

That said, these few patches start with a (hopefully) simple and correct form of the queue spinlock, and then gradually build upon it, explaining each optimization as we go.

Having these optimizations as separate patches helps twofold; firstly it makes one aware of which exact optimizations were done, and secondly it allows one to proove or disprove any one step; seeing how they should be mostly identity transforms.

The resulting code is near to what you posted I think; however it has one atomic op less in the pending wait-acquire case for NR_CPUS != huge. It also doesn't do lock stealing; its still perfectly fair afaict.

Have I missed any tricks from your code?

The patches apply to tip/master + lkml.kernel.org/r/[email protected]

I've yet to look at the paravirt stuff.