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: move max entry definition and ring sizing into header

In preparation for needing this somewhere else, move the definitions
for the maximum CQ and SQ ring size into io_uring.h. Make the
rings_size() helper available as well, and have it take just the setup
flags argument rather than the fill ring pointer. That's all that is
needed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+11 -8
+6 -8
io_uring/io_uring.c
··· 105 105 #include "alloc_cache.h" 106 106 #include "eventfd.h" 107 107 108 - #define IORING_MAX_ENTRIES 32768 109 - #define IORING_MAX_CQ_ENTRIES (2 * IORING_MAX_ENTRIES) 110 - 111 108 #define SQE_COMMON_FLAGS (IOSQE_FIXED_FILE | IOSQE_IO_LINK | \ 112 109 IOSQE_IO_HARDLINK | IOSQE_ASYNC) 113 110 ··· 2664 2667 ctx->sq_sqes = NULL; 2665 2668 } 2666 2669 2667 - static unsigned long rings_size(struct io_ring_ctx *ctx, unsigned int sq_entries, 2668 - unsigned int cq_entries, size_t *sq_offset) 2670 + unsigned long rings_size(unsigned int flags, unsigned int sq_entries, 2671 + unsigned int cq_entries, size_t *sq_offset) 2669 2672 { 2670 2673 struct io_rings *rings; 2671 2674 size_t off, sq_array_size; ··· 2673 2676 off = struct_size(rings, cqes, cq_entries); 2674 2677 if (off == SIZE_MAX) 2675 2678 return SIZE_MAX; 2676 - if (ctx->flags & IORING_SETUP_CQE32) { 2679 + if (flags & IORING_SETUP_CQE32) { 2677 2680 if (check_shl_overflow(off, 1, &off)) 2678 2681 return SIZE_MAX; 2679 2682 } ··· 2684 2687 return SIZE_MAX; 2685 2688 #endif 2686 2689 2687 - if (ctx->flags & IORING_SETUP_NO_SQARRAY) { 2690 + if (flags & IORING_SETUP_NO_SQARRAY) { 2688 2691 *sq_offset = SIZE_MAX; 2689 2692 return off; 2690 2693 } ··· 3431 3434 ctx->sq_entries = p->sq_entries; 3432 3435 ctx->cq_entries = p->cq_entries; 3433 3436 3434 - size = rings_size(ctx, p->sq_entries, p->cq_entries, &sq_array_offset); 3437 + size = rings_size(ctx->flags, p->sq_entries, p->cq_entries, 3438 + &sq_array_offset); 3435 3439 if (size == SIZE_MAX) 3436 3440 return -EOVERFLOW; 3437 3441
+5
io_uring/io_uring.h
··· 65 65 return dist >= 0 || atomic_read(&ctx->cq_timeouts) != iowq->nr_timeouts; 66 66 } 67 67 68 + #define IORING_MAX_ENTRIES 32768 69 + #define IORING_MAX_CQ_ENTRIES (2 * IORING_MAX_ENTRIES) 70 + 71 + unsigned long rings_size(unsigned int flags, unsigned int sq_entries, 72 + unsigned int cq_entries, size_t *sq_offset); 68 73 bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow); 69 74 int io_run_task_work_sig(struct io_ring_ctx *ctx); 70 75 void io_req_defer_failed(struct io_kiocb *req, s32 res);