io_uring: correct size of overflow CQE calculation
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: e26dca67fd ("io_uring: add support for IORING_SETUP_CQE_MIXED")
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
pull/1354/merge
parent
9f5f69d98e
commit
9adc6669a6
|
|
@ -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) {
|
if (cqe->flags & IORING_CQE_F_32 || ctx->flags & IORING_SETUP_CQE32) {
|
||||||
is_cqe32 = true;
|
is_cqe32 = true;
|
||||||
ocq_size <<= 1;
|
ocq_size += sizeof(struct io_uring_cqe);
|
||||||
}
|
}
|
||||||
|
|
||||||
ocqe = kzalloc(ocq_size, gfp | __GFP_ACCOUNT);
|
ocqe = kzalloc(ocq_size, gfp | __GFP_ACCOUNT);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue