]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
locking/semaphore: Remove the list_head from struct semaphore
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 5 Mar 2026 19:55:42 +0000 (19:55 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Sun, 8 Mar 2026 10:06:52 +0000 (11:06 +0100)
commitb9bdd4b6840454ef87f61b6506c9635c57a81650
tree72739b8a22862bdf1de150c58277635986e7e4bf
parent1ea4b473504b6dc6a0d21c298519aff2d52433c9
locking/semaphore: Remove the list_head from struct semaphore

Instead of embedding a list_head in struct semaphore, store a pointer to
the first waiter.  The list of waiters remains a doubly linked list so
we can efficiently add to the tail of the list and remove from the front
(or middle) of the list.

Some of the list manipulation becomes more complicated, but it's a
reasonable tradeoff on the slow paths to shrink data structures
which embed a semaphore.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260305195545.3707590-3-willy@infradead.org
drivers/acpi/osl.c
include/linux/semaphore.h
kernel/locking/semaphore.c