Skip to content

Commit fc66677

Browse files
committed
io_uring: use system_unbound_wq for ring exit work
We currently use system_wq, which is unbounded in terms of number of workers. This means that if we're exiting tons of rings at the same time, then we'll briefly spawn tons of event kworkers just for a very short blocking time as the rings exit. Use system_unbound_wq instead, which has a sane cap on the concurrency level. Signed-off-by: Jens Axboe <[email protected]>
1 parent 8452fd0 commit fc66677

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/io_uring.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7960,7 +7960,13 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
79607960
ACCT_LOCKED);
79617961

79627962
INIT_WORK(&ctx->exit_work, io_ring_exit_work);
7963-
queue_work(system_wq, &ctx->exit_work);
7963+
/*
7964+
* Use system_unbound_wq to avoid spawning tons of event kworkers
7965+
* if we're exiting a ton of rings at the same time. It just adds
7966+
* noise and overhead, there's no discernable change in runtime
7967+
* over using system_wq.
7968+
*/
7969+
queue_work(system_unbound_wq, &ctx->exit_work);
79647970
}
79657971

79667972
static int io_uring_release(struct inode *inode, struct file *file)

0 commit comments

Comments
 (0)