From fc2ce8a878bd5acb8881e9408f6e0484d9b446c5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 14 Feb 2024 14:37:23 -0500 Subject: ioq: Make -j also limit the io_uring worker threads --- src/ioq.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/ioq.c b/src/ioq.c index ede2413..0126f5c 100644 --- a/src/ioq.c +++ b/src/ioq.c @@ -755,6 +755,15 @@ struct ioq *ioq_create(size_t depth, size_t nthreads) { // 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); + + if (!prev && thread->ring_err == 0) { + // Limit the number of io_uring workers + unsigned int values[] = { + [IO_WQ_BOUND] = nthreads, + [IO_WQ_UNBOUND] = 0, + }; + io_uring_register_iowq_max_workers(&thread->ring, values); + } } #endif -- cgit v1.2.3