Netdev List
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 6/8] io_uring/zcrx: notify user when out of buffers
Date: Tue, 19 May 2026 09:26:58 -0600	[thread overview]
Message-ID: <7bfd707b-1e21-413e-a2e7-71e8df3e43d7@kernel.dk> (raw)
In-Reply-To: <35cd307a03a43583838a2e151fc641c69abd786f.1779189667.git.asml.silence@gmail.com>

On 5/19/26 5:44 AM, Pavel Begunkov wrote:
> @@ -1126,6 +1142,48 @@ static unsigned io_zcrx_refill_slow(struct page_pool *pp, struct io_zcrx_ifq *if
>  	return allocated;
>  }
>  
> +static void zcrx_notif_tw(struct io_tw_req tw_req, io_tw_token_t tw)
> +{
> +	struct io_kiocb *req = tw_req.req;
> +	struct io_ring_ctx *ctx = req->ctx;
> +
> +	io_post_aux_cqe(ctx, req->cqe.user_data, req->cqe.res, 0);
> +	percpu_ref_put(&ctx->refs);
> +	io_poison_req(req);
> +	kmem_cache_free(req_cachep, req);
> +}
> +
> +static void zcrx_send_notif(struct io_zcrx_ifq *ifq, unsigned type)
> +{
> +	gfp_t gfp = GFP_ATOMIC | __GFP_NOWARN | __GFP_ZERO;
> +	u32 type_mask = 1 << type;
> +	struct io_kiocb *req;
> +
> +	if (!(type_mask & ifq->allowed_notif_mask))
> +		return;
> +
> +	guard(spinlock_bh)(&ifq->ctx_lock);
> +	if (!ifq->master_ctx)
> +		return;
> +	if (type_mask & ifq->fired_notifs)
> +		return;
> +
> +	req = kmem_cache_alloc(req_cachep, gfp);
> +	if (unlikely(!req))
> +		return;

It'd be nice to avoid an allocation here inside ctx_lock and with bh's
disabled, which looks like is also the only reason why GFP_ATOMIC is
being used here.

Maybe opportunistically check ->fired_notifs early? Might also avoid the
lock in the first place if we get back-to-back of these.

-- 
Jens Axboe

  reply	other threads:[~2026-05-19 15:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 11:44 [PATCH 0/8] first zcrx updates for 7.2 Pavel Begunkov
2026-05-19 11:44 ` [PATCH 1/8] io_uring/zcrx: make scrubbing more reliable Pavel Begunkov
2026-05-19 11:44 ` [PATCH 2/8] io_uring/zcrx: poison pointers on unregistration Pavel Begunkov
2026-05-19 11:44 ` [PATCH 3/8] io_uring/zcrx: remove extra ifq close Pavel Begunkov
2026-05-19 11:44 ` [PATCH 4/8] io_uring/zcrx: reorder fd allocation in zcrx_export() Pavel Begunkov
2026-05-19 11:44 ` [PATCH 5/8] io_uring/zcrx: add ctx pointer to zcrx Pavel Begunkov
2026-05-19 11:46   ` Pavel Begunkov
2026-05-19 11:44 ` [PATCH 6/8] io_uring/zcrx: notify user when out of buffers Pavel Begunkov
2026-05-19 15:26   ` Jens Axboe [this message]
2026-05-19 15:30     ` Pavel Begunkov
2026-05-19 15:37       ` Jens Axboe
2026-05-19 15:40         ` Pavel Begunkov
2026-05-19 15:43           ` Jens Axboe
2026-05-19 16:04             ` Pavel Begunkov
2026-05-19 16:08               ` Pavel Begunkov
2026-05-19 16:09               ` Jens Axboe
2026-05-19 11:44 ` [PATCH 7/8] io_uring/zcrx: notify user on frag copy fallback Pavel Begunkov
2026-05-19 11:44 ` [PATCH 8/8] io_uring/zcrx: add shared-memory notification statistics Pavel Begunkov

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=7bfd707b-1e21-413e-a2e7-71e8df3e43d7@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --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