* [PATCH for-next] io_uring: correct size of overflow CQE calculation
@ 2025-09-10 16:41 Jens Axboe
2025-09-10 18:06 ` Caleb Sander Mateos
0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2025-09-10 16:41 UTC (permalink / raw)
To: io-uring
If a 32b CQE is required, don't double the size of the overflow struct,
just add the size of the io_uring_cqe addition that is needed. This
avoids allocating too much memory, as the io_overflow_cqe size includes
the list member required to queue them too.
Fixes: e26dca67fde1 ("io_uring: add support for IORING_SETUP_CQE_MIXED")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 6d62f10416eb..1bfa124565f7 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -756,7 +756,7 @@ static struct io_overflow_cqe *io_alloc_ocqe(struct io_ring_ctx *ctx,
if (cqe->flags & IORING_CQE_F_32 || ctx->flags & IORING_SETUP_CQE32) {
is_cqe32 = true;
- ocq_size <<= 1;
+ ocq_size += sizeof(struct io_uring_cqe);
}
ocqe = kzalloc(ocq_size, gfp | __GFP_ACCOUNT);
--
Jens Axboe
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH for-next] io_uring: correct size of overflow CQE calculation
2025-09-10 16:41 [PATCH for-next] io_uring: correct size of overflow CQE calculation Jens Axboe
@ 2025-09-10 18:06 ` Caleb Sander Mateos
0 siblings, 0 replies; 2+ messages in thread
From: Caleb Sander Mateos @ 2025-09-10 18:06 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring
On Wed, Sep 10, 2025 at 9:42 AM Jens Axboe <axboe@kernel.dk> wrote:
>
> If a 32b CQE is required, don't double the size of the overflow struct,
> just add the size of the io_uring_cqe addition that is needed. This
> avoids allocating too much memory, as the io_overflow_cqe size includes
> the list member required to queue them too.
>
> Fixes: e26dca67fde1 ("io_uring: add support for IORING_SETUP_CQE_MIXED")
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-10 20:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-10 16:41 [PATCH for-next] io_uring: correct size of overflow CQE calculation Jens Axboe
2025-09-10 18:06 ` Caleb Sander Mateos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox