[PATCH v2] io_uring: drop overflowing CQE instead of exceeding memory limits

Alexandre Negrel posted 1 patch 1 month, 1 week ago
io_uring/io_uring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] io_uring: drop overflowing CQE instead of exceeding memory limits
Posted by Alexandre Negrel 1 month, 1 week ago
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
Re: [PATCH v2] io_uring: drop overflowing CQE instead of exceeding memory limits
Posted by Jens Axboe 1 month, 1 week ago
On Tue, 30 Dec 2025 19:57:28 +0100, Alexandre Negrel wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] io_uring: drop overflowing CQE instead of exceeding memory limits
      (no commit info)

Best regards,
-- 
Jens Axboe