Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jinjie Ruan" <ruanjinjie@huawei.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v3 3/8] fs: aio: Use acquire/release for ring->tail publication
Date: Wed, 02 Sep 2026 07:57:15 +0000	[thread overview]
Message-ID: <20260902075715.B35761F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902074805.398540-4-ruanjinjie@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims to replace `WRITE_ONCE()` and `READ_ONCE()` which do not exist in the baseline code.
--

commit 8b8ddb17380f4323933c3731f5ced979ef864fa3
Author: Jinjie Ruan <ruanjinjie@huawei.com>

fs: aio: Use acquire/release for ring->tail publication

This commit replaces the explicit write and read memory barriers for
ring->tail with smp_store_release() and smp_load_acquire() in the aio
completion and read event paths. It aims to clarify the publish/subscribe
pattern and optimize for architectures with native acquire/release
instructions.

> Replace the smp_wmb() + WRITE_ONCE(ring->tail) and READ_ONCE(ring->tail)
> + smp_rmb() barrier pair with smp_store_release()/smp_load_acquire()
> on `ring->tail`.

[Severity: Medium]
Does this commit message accurately reflect the previous state of the code?

The message explicitly claims to replace WRITE_ONCE(ring->tail) and
READ_ONCE(ring->tail). However, the baseline code only used plain assignments
as seen in the diff below.

> diff --git a/fs/aio.c b/fs/aio.c
> index ebdb0e5b95fd9..a6ec7c51ac456 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1206,13 +1206,12 @@ static void aio_complete(struct aio_kiocb *iocb)
>  	/* after flagging the request as done, we
>  	 * must never even look at it again
>  	 */
> -	smp_wmb();	/* make event visible before updating tail */
> -
>  	ctx->tail = tail;
>  
>  	ring = folio_address(ctx->ring_folios[0]);
>  	head = ring->head;
> -	ring->tail = tail;
> +	/* Make event visible before updating tail */
> +	smp_store_release(&ring->tail, tail);
>  	flush_dcache_folio(ctx->ring_folios[0]);

[Severity: Medium]
Could the commit message be updated to clarify that this patch also fixes the
missing WRITE_ONCE() annotation?

The baseline code here in fs/aio.c:aio_complete() performed a plain write
with "ring->tail = tail;" rather than using WRITE_ONCE() as claimed.

[ ... ]

> @@ -1288,13 +1287,12 @@ static long aio_read_events_ring(struct kioctx *ctx,
>  	/* Access to ->ring_folios here is protected by ctx->ring_lock. */
>  	ring = folio_address(ctx->ring_folios[0]);
>  	head = ring->head;
> -	tail = ring->tail;
> -
>  	/*
>  	 * Ensure that once we've read the current tail pointer, that
>  	 * we also see the events that were stored up to the tail.
> +	 * Pairs with smp_store_release() in aio_complete().
>  	 */
> -	smp_rmb();
> +	tail = smp_load_acquire(&ring->tail);

[Severity: Medium]
Similarly, could the commit message note that this fixes a missing
READ_ONCE() annotation?

The baseline code here in fs/aio.c:aio_read_events_ring() used a plain read
with "tail = ring->tail;" instead of the claimed READ_ONCE().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902074805.398540-1-ruanjinjie@huawei.com?part=3

  reply	other threads:[~2026-09-02  7:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  7:47 [PATCH v3 0/8] Convert barrier pairs to acquire/release for better performance Jinjie Ruan
2026-09-02  7:47 ` [PATCH v3 1/8] user_namespace: Use acquire/release for nr_extents synchronization Jinjie Ruan
2026-09-02  7:53   ` sashiko-bot
2026-09-02 10:09   ` Bradley Morgan
2026-09-02  7:47 ` [PATCH v3 2/8] lib/vsprintf: Use acquire/release for ptr_key publication Jinjie Ruan
2026-09-02  7:52   ` sashiko-bot
2026-09-02  7:48 ` [PATCH v3 3/8] fs: aio: Use acquire/release for ring->tail publication Jinjie Ruan
2026-09-02  7:57   ` sashiko-bot [this message]
2026-09-02  7:48 ` [PATCH v3 4/8] fs: Use acquire/release for fdtable resize synchronization Jinjie Ruan
2026-09-02  7:53   ` sashiko-bot
2026-09-02  7:48 ` [PATCH v3 5/8] pidfs: Use test_bit_acquire() for attr flag tests Jinjie Ruan
2026-09-02  7:55   ` sashiko-bot
2026-09-02  7:48 ` [PATCH v3 6/8] super: Use acquire for SB_BORN check in super_cache_count() Jinjie Ruan
2026-09-02  7:58   ` sashiko-bot
2026-09-02  7:48 ` [PATCH v3 7/8] ext4: Fix out-of-bounds read in ext4_get_group_info() Jinjie Ruan
2026-09-02  8:01   ` sashiko-bot
2026-09-02  7:48 ` [PATCH v3 8/8] ext4: Convert group-count barrier protocol to acquire/release Jinjie Ruan
2026-09-02  7:58   ` sashiko-bot

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=20260902075715.B35761F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ruanjinjie@huawei.com \
    --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