Re: [RFC 1/1] rwsem: Shrink rwsem by one pointer
From: Waiman Long
Date: Wed Feb 18 2026 - 17:48:12 EST
On 2/17/26 2:08 PM, Matthew Wilcox (Oracle) wrote:
Instead of embedding a list_head in struct rw_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, 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 some core data structures
like struct inode.
If the goal is to use only one pointer for the rwsem structure, would it make sense to change list_head to hlist_head for instance? At least we have existing helpers that can be used instead of making our own coding convention here.
Cheers,
Longman