[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0a9d9e34-a351-4168-bbdc-3ca3b6c3e17b@kernel.dk>
Date: Sat, 25 Oct 2025 17:37:48 -0600
From: Jens Axboe <axboe@...nel.dk>
To: David Wei <dw@...idwei.uk>, io-uring@...r.kernel.org,
netdev@...r.kernel.org
Cc: Pavel Begunkov <asml.silence@...il.com>
Subject: Re: [PATCH v2 2/5] io_uring/zcrx: add refcount to struct io_zcrx_ifq
On 10/25/25 1:15 PM, David Wei wrote:
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index a816f5902091..22d759307c16 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -730,6 +731,8 @@ void io_shutdown_zcrx_ifqs(struct io_ring_ctx *ctx)
> lockdep_assert_held(&ctx->uring_lock);
>
> xa_for_each(&ctx->zcrx_ctxs, index, ifq) {
> + if (refcount_read(&ifq->refs) > 1)
> + continue;
This is a bit odd, it's not an idiomatic way to use reference counts.
Why isn't this a refcount_dec_and_test()? Given that both the later grab
when sharing is enabled and the shutdown here are under the ->uring_lock
this may not matter, but it'd be a lot more obviously correct if it
looked ala:
if (refcount_dec_and_test(&ifq->refs)) {
io_zcrx_scrub(ifq);
io_close_queue(ifq);
}
instead?
--
Jens Axboe
Powered by blists - more mailing lists