summaryrefslogtreecommitdiffstats
path: root/src/ioq.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-02-14 14:37:23 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-02-14 14:37:23 -0500
commitfc2ce8a878bd5acb8881e9408f6e0484d9b446c5 (patch)
tree9008679dca9b031cb288ad0e6644dea838cf4ec1 /src/ioq.c
parent5f7cc43ba12c87b70fe1e8f8f225258e718048ba (diff)
downloadbfs-fc2ce8a878bd5acb8881e9408f6e0484d9b446c5.tar.xz
ioq: Make -j also limit the io_uring worker threads
Diffstat (limited to 'src/ioq.c')
-rw-r--r--src/ioq.c9
1 files changed, 9 insertions, 0 deletions
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, &params);
+
+ 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