From 22de67c71daae75dde04416bb532a25cd4d19f3e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 20 Nov 2024 11:53:38 -0500 Subject: ioq: Enable IORING_SETUP_SUBMIT_ALL --- src/ioq.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/ioq.c') diff --git a/src/ioq.c b/src/ioq.c index be5b758..02985da 100644 --- a/src/ioq.c +++ b/src/ioq.c @@ -836,16 +836,32 @@ static int ioq_ring_init(struct ioq *ioq, struct ioq_thread *thread) { return -1; } - // Share io-wq workers between rings struct io_uring_params params = {0}; + +#ifdef IORING_SETUP_SUBMIT_ALL + // Don't abort submission just because an inline request fails + params.flags |= IORING_SETUP_SUBMIT_ALL; +#endif + + // Share io-wq workers between rings if (prev) { - params.flags |= IORING_SETUP_ATTACH_WQ; + params.flags = prev->ring.flags | IORING_SETUP_ATTACH_WQ; params.wq_fd = prev->ring.ring_fd; } // Use a page for each SQE ring size_t entries = 4096 / sizeof(struct io_uring_sqe); thread->ring_err = -io_uring_queue_init_params(entries, &thread->ring, ¶ms); + +#ifdef IORING_SETUP_SUBMIT_ALL + if (thread->ring_err == EINVAL && (params.flags & IORING_SETUP_SUBMIT_ALL)) { + // IORING_SETUP_SUBMIT_ALL is only supported since Linux 5.18, + // so try again without it + params.flags &= ~IORING_SETUP_SUBMIT_ALL; + thread->ring_err = -io_uring_queue_init_params(entries, &thread->ring, ¶ms); + } +#endif + if (thread->ring_err) { return -1; } -- cgit v1.2.3