public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Negrel <alexandre@negrel.dev>
To: axboe@kernel.dk, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Alexandre Negrel <alexandre@negrel.dev>
Subject: [PATCH v2] io_uring: drop overflowing CQE instead of exceeding memory limits
Date: Tue, 30 Dec 2025 19:57:28 +0100	[thread overview]
Message-ID: <20251230190909.557152-1-alexandre@negrel.dev> (raw)

Allocate the overflowing CQE with GFP_NOWAIT instead of GFP_ATOMIC. This
changes causes allocations to fail in out-of-memory situations,
resulting in CQE being dropped. Using GFP_ATOMIC allows a process to
exceed memory limits.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220794
Signed-off-by: Alexandre Negrel <alexandre@negrel.dev>
---
 io_uring/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 6cb24cdf8e68..709943fedaf4 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -864,7 +864,7 @@ static __cold bool io_cqe_overflow_locked(struct io_ring_ctx *ctx,
 {
 	struct io_overflow_cqe *ocqe;
 
-	ocqe = io_alloc_ocqe(ctx, cqe, big_cqe, GFP_ATOMIC);
+	ocqe = io_alloc_ocqe(ctx, cqe, big_cqe, GFP_NOWAIT);
 	return io_cqring_add_overflow(ctx, ocqe);
 }
 
-- 
2.51.0


             reply	other threads:[~2025-12-30 19:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 18:57 Alexandre Negrel [this message]
2025-12-31  1:50 ` [PATCH v2] io_uring: drop overflowing CQE instead of exceeding memory limits Jens Axboe

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=20251230190909.557152-1-alexandre@negrel.dev \
    --to=alexandre@negrel.dev \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@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