diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-02-14 14:37:23 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-02-14 14:37:23 -0500 |
commit | fc2ce8a878bd5acb8881e9408f6e0484d9b446c5 (patch) | |
tree | 9008679dca9b031cb288ad0e6644dea838cf4ec1 /src | |
parent | 5f7cc43ba12c87b70fe1e8f8f225258e718048ba (diff) | |
download | bfs-fc2ce8a878bd5acb8881e9408f6e0484d9b446c5.tar.xz |
ioq: Make -j also limit the io_uring worker threads
Diffstat (limited to 'src')
-rw-r--r-- | src/ioq.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 |