The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Waiman Long <longman@redhat.com>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org
Subject: [RFC 0/1] Shrinking rwsem
Date: Tue, 17 Feb 2026 19:08:33 +0000	[thread overview]
Message-ID: <20260217190835.1151964-1-willy@infradead.org> (raw)

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@lst.de/

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


             reply	other threads:[~2026-02-17 19:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 19:08 Matthew Wilcox (Oracle) [this message]
2026-02-17 19:08 ` [RFC 1/1] rwsem: Shrink rwsem by one pointer Matthew Wilcox (Oracle)
2026-02-17 20:27   ` Linus Torvalds
2026-02-18 21:00     ` Matthew Wilcox
2026-02-18 21:37       ` Linus Torvalds
2026-02-18 22:26       ` Peter Zijlstra
2026-02-18 22:45       ` Linus Torvalds
2026-02-18 22:52         ` Linus Torvalds
2026-03-04 19:51           ` Matthew Wilcox
2026-02-18 22:47   ` Waiman Long
2026-02-18 23:06     ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260217190835.1151964-1-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=boqun.feng@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox