[PATCH 0/3] Shrink size of sleeping locks

From: Matthew Wilcox (Oracle)

Date: Thu Mar 05 2026 - 14:56:14 EST


This series shrinks the mutex, semaphore and rw_semaphore by one pointer
by changing the list_head to a pointer to the first waiter. Some sample
savings with the Debian config:

task_struct 5696 to 5632 bytes (89 to 88 cache lines)
mm_struct 1728 to 1600 bytes (27 to 25 cache lines)
mm_mm_cid 192 to 128 bytes (3 to 2 cache lines)
file 184 to 176 bytes (from 22 objects per 4kB slab to 23)
inode 608 to 584 bytes (from 13 objects per 8kB slab to 14)

Changes from RFC:

- Added patches for semaphore & mutex
- Undid inadvertent change to rwsem_del_wake_waiter()
- Attempted to follow Peter's preferred coding style

Matthew Wilcox (Oracle) (3):
rwsem: Remove the list_head from struct rw_semaphore
semaphore: Remove the list_head from struct semaphore
mutex: Remove the list_head from struct mutex

drivers/acpi/osl.c | 2 +-
include/linux/mutex.h | 2 +-
include/linux/mutex_types.h | 2 +-
include/linux/rwsem.h | 8 ++--
include/linux/semaphore.h | 4 +-
kernel/locking/mutex-debug.c | 5 +-
kernel/locking/mutex.c | 49 +++++++++++---------
kernel/locking/rwsem.c | 89 +++++++++++++++++++++++-------------
kernel/locking/semaphore.c | 41 +++++++++++++----
kernel/locking/ww_mutex.h | 25 +++-------
10 files changed, 132 insertions(+), 95 deletions(-)

--
2.47.3