From: sashiko-bot@kernel.org
To: JonasZhou-oc <jonaszhou-oc@zhaoxin.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [RFC PATCH] ext4: cacheline-align inode cache to avoid false sharing
Date: Thu, 27 Aug 2026 07:51:12 +0000 [thread overview]
Message-ID: <20260827075112.B0C3E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827074334.616360-1-jonaszhou-oc@zhaoxin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Fragile performance optimization relying on configuration-dependent struct layout
--
commit 7acd8c0fa63f737f049b6c32ef756e22fa1aeabb
Author: JonasZhou-oc <jonaszhou-oc@zhaoxin.com>
ext4: cacheline-align inode cache to avoid false sharing
This patch adds SLAB_HWCACHE_ALIGN to the ext4 inode cache creation flags.
The goal is to align the embedded vfs_inode.i_rwsem to a cache-line boundary
to avoid false sharing with other metadata.
Link: https://lore.kernel.org/linux-fsdevel/CAGudoHFgtM8Px4mRNM_fsmi3=vAyCMPC3FBCzk5uE7ma7fdbdQ@mail.gmail.com/
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index bca0dc87d0b7c..49ac97af19945 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1519,7 +1519,8 @@ static int __init init_inodecache(void)
> ext4_inode_cachep = kmem_cache_create("ext4_inode_cache",
> sizeof(struct ext4_inode_info),
> &args,
> - SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT);
> + SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT |
> + SLAB_HWCACHE_ALIGN);
[Severity: Medium]
Will this reliably align i_rwsem to a cache-line boundary across different
kernel configurations?
The offset of i_rwsem within struct ext4_inode_info is highly dependent on
kernel configurations. Options like CONFIG_LOCKDEP or CONFIG_DEBUG_SPINLOCK
can alter the sizes of preceding spinlock_t and struct rw_semaphore fields.
While SLAB_HWCACHE_ALIGN ensures the start of struct ext4_inode_info is
cache-line aligned, the varying internal offset of i_rwsem means it may still
arbitrarily span cache-line boundaries or share a line with heavily modified
metadata in other builds.
Does this optimization risk uniformly imposing memory overhead while failing to
provide the performance benefit on varying configurations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827074334.616360-1-jonaszhou-oc@zhaoxin.com?part=1
next prev parent reply other threads:[~2026-08-27 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 7:43 [RFC PATCH] ext4: cacheline-align inode cache to avoid false sharing JonasZhou-oc
2026-08-27 7:51 ` sashiko-bot [this message]
2026-09-07 5:57 ` JonasZhou-oc
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=20260827075112.B0C3E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jonaszhou-oc@zhaoxin.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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