Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: deduplicate array_size in io_allocate_scq_urings

A minor cleanup precomputing the sq size first instead of branching
array_size() in io_allocate_scq_urings().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
12aced0a ab673c1b

+5 -3
+5 -3
io_uring/io_uring.c
··· 3610 3610 struct io_uring_region_desc rd; 3611 3611 struct io_rings *rings; 3612 3612 size_t size, sq_array_offset; 3613 + size_t sqe_size; 3613 3614 int ret; 3614 3615 3615 3616 /* make sure these are sane, as we already accounted them */ ··· 3640 3639 rings->sq_ring_entries = p->sq_entries; 3641 3640 rings->cq_ring_entries = p->cq_entries; 3642 3641 3642 + sqe_size = sizeof(struct io_uring_sqe); 3643 3643 if (p->flags & IORING_SETUP_SQE128) 3644 - size = array_size(2 * sizeof(struct io_uring_sqe), p->sq_entries); 3645 - else 3646 - size = array_size(sizeof(struct io_uring_sqe), p->sq_entries); 3644 + sqe_size *= 2; 3645 + 3646 + size = array_size(sqe_size, p->sq_entries); 3647 3647 if (size == SIZE_MAX) { 3648 3648 io_rings_free(ctx); 3649 3649 return -EOVERFLOW;