[PATCH v4 next 0/9] locking/osq_lock: Optimisations to osq_lock code
From: David Laight
Date: Mon Sep 07 2026 - 04:47:26 EST
This is a continuation of some patches I wrote over two years ago.
They go a lot further and reduce the per-cpu data to a structure
that only contains two cpu numbers.
I've fixed some broken/missing memory barriers but left the initial xchg()
when acquiring the lock as a full barrier, I think it could be relaxed.
Tested with a userspace harness that can conditionally sleep at various points.
David Laight (9):
locking/osq_lock: Add some comments about how it works
locking/osq_lock: Save the cpu number for 'prev' not the node address
locking/osq_lock: Set prev_cpu=0 instead of locked=1
locking/osq_lock: Delete 'fast path' code from osq_unlock()
locking/osq_lock: Avoid writing to node->next in the osq_lock() fast
path
locking/osq: Use cpu number for 'next' pointer
locking/osq: Use 'unsigned int' for next/prev/tail
locking/osq: inline encode_cpu() and rename decode_cpu()
locking/osq_lock: Swap next<->prev and tail<->head
include/linux/osq_lock.h | 10 +-
kernel/locking/osq_lock.c | 286 ++++++++++++++++++++------------------
2 files changed, 154 insertions(+), 142 deletions(-)
--
2.39.5