Skip to content

Commit

Permalink
src/setup: fix io_uring_alloc_huge() for SQE128
Browse files Browse the repository at this point in the history
Double the SQE size if IORING_SETUP_SQE128 is set, don't just use the
normal SQE size.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Dec 30, 2024
1 parent 460c1b4 commit 299d140
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int io_uring_alloc_huge(unsigned entries, struct io_uring_params *p,
{
unsigned long page_size = get_page_size();
unsigned sq_entries, cq_entries;
size_t ring_mem, sqes_mem, cqes_mem;
size_t ring_mem, sqes_mem, cqes_mem, sqe_size;
unsigned long mem_used = 0;
void *ptr;
int ret;
Expand All @@ -220,7 +220,10 @@ static int io_uring_alloc_huge(unsigned entries, struct io_uring_params *p,

ring_mem = KRING_SIZE;

sqes_mem = sq_entries * sizeof(struct io_uring_sqe);
sqe_size = sizeof(struct io_uring_sqe);
if (p->flags & IORING_SETUP_SQE128)
sqe_size <<= 1;
sqes_mem = sq_entries * sqe_size;
if (!(p->flags & IORING_SETUP_NO_SQARRAY))
sqes_mem += sq_entries * sizeof(unsigned);
sqes_mem = (sqes_mem + page_size - 1) & ~(page_size - 1);
Expand Down

0 comments on commit 299d140

Please sign in to comment.