Thread (12 messages) 12 messages, 2 authors, 2025-10-30

Re: [PATCH v4 7/8] io_uring/zcrx: add refcount to ifq and remove ifq->ctx

From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2025-10-30 15:24:37
Also in: io-uring

On 10/29/25 16:16, Pavel Begunkov wrote:
On 10/29/25 15:22, Pavel Begunkov wrote:
quoted
On 10/28/25 17:46, David Wei wrote:
...>>>   void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx)
quoted
quoted
  {
      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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help