[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b0890420-6897-4ef9-a15a-8b9721ce85d0@gmail.com>
Date: Thu, 30 Oct 2025 15:24:33 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: David Wei <dw@...idwei.uk>, io-uring@...r.kernel.org,
netdev@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH v4 7/8] io_uring/zcrx: add refcount to ifq and remove
ifq->ctx
On 10/29/25 16:16, Pavel Begunkov wrote:
> On 10/29/25 15:22, Pavel Begunkov wrote:
>> On 10/28/25 17:46, David Wei wrote:
...>>> void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx)
>>> {
>>> struct io_zcrx_ifq *ifq;
>>> @@ -743,7 +730,10 @@ void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx)
>>> }
>>> if (!ifq)
>>> break;
>>> - io_zcrx_ifq_free(ifq);
>>> + if (refcount_dec_and_test(&ifq->refs)) {
>>> + io_zcrx_scrub(ifq);
>>> + io_zcrx_ifq_free(ifq);
>>> + }
>>> }
>>> xa_destroy(&ctx->zcrx_ctxs);
>>> @@ -894,15 +884,11 @@ static int io_pp_zc_init(struct page_pool *pp)
>>> if (ret)
>>> return ret;
>>> - percpu_ref_get(&ifq->ctx->refs);
>>> return 0;
>>
>> refcount_inc();
>
> Which would add another ref cycle problem, the same that IIRC
> was solved with two step shutdown + release. I'll take a closer
> look.
The simplest solution is to keep the two 2 level release and
split refcounting for sharing. It's still better as now
shutdown can be folded into the io_uring ifq unregstration
helper.
https://github.com/isilence/linux.git zcrx/zcrx-sharing
https://github.com/isilence/liburing.git zcrx/zcrx-sharing
I fixed up synchronisation and drafted the export/import via
a file part, take a look.
--
Pavel Begunkov
Powered by blists - more mailing lists