From: David Wei <dw@davidwei.uk>
To: Jens Axboe <axboe@kernel.dk>,
io-uring@vger.kernel.org, netdev@vger.kernel.org
Cc: Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH v2 2/5] io_uring/zcrx: add refcount to struct io_zcrx_ifq
Date: Sat, 25 Oct 2025 21:10:41 -0700 [thread overview]
Message-ID: <74ce4fb9-3654-4a1d-9b8b-abee8aba9ca9@davidwei.uk> (raw)
In-Reply-To: <0a9d9e34-a351-4168-bbdc-3ca3b6c3e17b@kernel.dk>
On 2025-10-25 16:37, Jens Axboe wrote:
> 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?
>
Yeah, good idea. Your comments prompted me to try to find a better
solution that gets rid of ifq->proxy. Turns out xarray has 3 bits per
entry that can be 'marked'. With this I can get a cleaner solution. Will
respin tomorrow.
next prev parent reply other threads:[~2025-10-26 4:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-25 19:14 [PATCH v2 0/5] io_uring zcrx ifq sharing David Wei
2025-10-25 19:15 ` [PATCH v2 1/5] io_uring/rsrc: rename and export io_lock_two_rings() David Wei
2025-10-25 19:15 ` [PATCH v2 2/5] io_uring/zcrx: add refcount to struct io_zcrx_ifq David Wei
2025-10-25 23:37 ` Jens Axboe
2025-10-26 4:10 ` David Wei [this message]
2025-10-25 19:15 ` [PATCH v2 3/5] io_uring/zcrx: share an ifq between rings David Wei
2025-10-25 23:41 ` Jens Axboe
2025-10-26 4:12 ` David Wei
2025-10-26 13:16 ` Jens Axboe
2025-10-26 13:43 ` Jens Axboe
2025-10-26 15:06 ` David Wei
2025-10-25 19:15 ` [PATCH v2 4/5] io_uring/zcrx: redirect io_recvzc on proxy ifq to src ifq David Wei
2025-10-25 19:15 ` [PATCH v2 5/5] io_uring/zcrx: free proxy ifqs David Wei
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=74ce4fb9-3654-4a1d-9b8b-abee8aba9ca9@davidwei.uk \
--to=dw@davidwei.uk \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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