[RFC 0/1] Shrinking rwsem
From: Matthew Wilcox (Oracle)
Date: Tue Feb 17 2026 - 14:09:29 EST
Some of Christoph's recent work has pointed out that we're achingly
close to being able to squeeze one more inode into each slab [1].
There are currently three rwsems embedded in struct inode --
invalidate_lock, i_mmap_rwsem and i_rwsem, so this saves us 24 bytes.
Of course, it'll shrink a lot of other data structures that embed
an rwsem (anon_vma and mm_struct come to mind).
We can do the same trick to struct mutex, but I thought I'd send this
out to see how people feel about the extra code complexity to make these
savings before investing any effort in doing that.
Maybe the performance bots will come back with some numbers, although
they've been weirdly sensitive to rwsem alignment in the past, so I'm
not sure I'd believe their numbers.
[1] https://lore.kernel.org/linux-fsdevel/20260202060754.270269-1-hch@xxxxxx/
Matthew Wilcox (Oracle) (1):
rwsem: Shrink rwsem by one pointer
include/linux/rwsem.h | 8 ++---
kernel/locking/rwsem.c | 74 +++++++++++++++++++++++++++++++-----------
2 files changed, 59 insertions(+), 23 deletions(-)
--
2.47.3