Linux EXT4 FS development
 help / color / mirror / Atom feed
From: JonasZhou-oc <jonaszhou-oc@zhaoxin.com>
To: sashiko-bot@kernel.org
Cc: jonaszhou-oc@zhaoxin.com, linux-ext4@vger.kernel.org,
	sashiko-reviews@lists.linux.dev, tytso@mit.edu
Subject: Re: [RFC PATCH] ext4: cacheline-align inode cache to avoid false sharing
Date: Mon,  7 Sep 2026 13:57:25 +0800	[thread overview]
Message-ID: <20260907055725.62128-1-jonaszhou-oc@zhaoxin.com> (raw)
In-Reply-To: <20260827075112.B0C3E1F000E9@smtp.kernel.org>

From: JonasZhou-oc <jonaszhou-oc@zhaoxin.com>

Thanks for pointing this out.

Yes, SLAB_HWCACHE_ALIGN aligns the allocation, but does not guarantee
that the embedded i_rwsem starts at a cache-line boundary in every
configuration. The offset of 384 bytes and the performance results
in the changelog apply only to the tested build. This dependency is
why I raised the layout question in the RFC.

In configurations with a different layout, the patch could increase
the allocation size without separating i_rwsem from the preceding
metadata. The size increase itself is also configuration-dependent;
the reported 16-byte increase applies to the tested build.

One possible refinement is to request SLAB_HWCACHE_ALIGN only when:

    IS_ALIGNED(offsetof(struct ext4_inode_info, vfs_inode) +
               offsetof(struct inode, i_rwsem),
               cache_line_size())

This would restrict the change to layouts where aligning the object
also places i_rwsem at a cache-line boundary. It would separate the
lock from preceding fields, but would not guarantee a performance
improvement or eliminate possible sharing with fields following it.

I have not yet tested this conditional variant. It would still need
configuration coverage and workload validation, including checking
the actual slab memory cost.

Would this layout-dependent opt-in be preferable, or would maintainers
prefer evaluating unconditional alignment with broader performance
and memory measurements?

Thanks,
Jonas


      reply	other threads:[~2026-09-07  5:57 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
2026-09-07  5:57   ` JonasZhou-oc [this message]

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=20260907055725.62128-1-jonaszhou-oc@zhaoxin.com \
    --to=jonaszhou-oc@zhaoxin.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko-bot@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