The active SB_BORN check in super_cache_count() pairs with the smp_store_release() in super_wake() when publishing a newly initialized superblock. Replace the historical independent smp_rmb() barrier with an acquire load on sb->s_flags via super_flags(). This expresses the publish-subscribe pattern more clearly and allows weakly-ordered architectures like arm64 to utilize efficient native instructions (e.g., LDAR) instead of a full one-way barrier. Also remove the outdated memory barrier comment in super_cache_count(), as the underlying super_flags() implementation already self-documents the matched smp_store_release() in super_wake(). Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Assisted-by: Gemini:Gemini-3.1 Assisted-by: DeepSeek:DeepSeek-V3 Reviewed-by: Jan Kara Signed-off-by: Jinjie Ruan --- fs/super.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/super.c b/fs/super.c index 05e443173038..caa6189e4057 100644 --- a/fs/super.c +++ b/fs/super.c @@ -267,12 +267,10 @@ static unsigned long super_cache_count(struct shrinker *shrink, * However, if we are currently mounting the superblock, the underlying * filesystem might be in a state of partial construction and hence it * is dangerous to access it. super_trylock_shared() uses a SB_BORN check - * to avoid this situation, so do the same here. The memory barrier is - * matched with the one in mount_fs() as we don't hold locks here. + * to avoid this situation, so do the same here. */ - if (!(sb->s_flags & SB_BORN)) + if (!super_flags(sb, SB_BORN)) return 0; - smp_rmb(); if (sb->s_op && sb->s_op->nr_cached_objects && super_fs_objects_eligible(sc)) -- 2.34.1