diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-08-19 11:10:51 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-08-19 11:10:51 -0600 |
commit | fc666777da9da387354b1a142a6ffc5d43bc4f7e (patch) | |
tree | 189f9106aac0c28192b82e04062246507dac164f /fs | |
parent | 8452fd0ce657a4313dfa784f11320971b67727fd (diff) | |
download | linux-stable-fc666777da9da387354b1a142a6ffc5d43bc4f7e.tar.gz linux-stable-fc666777da9da387354b1a142a6ffc5d43bc4f7e.tar.bz2 linux-stable-fc666777da9da387354b1a142a6ffc5d43bc4f7e.zip |
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 <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index e325895d681b..1f2f31d93686 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7960,7 +7960,13 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) ACCT_LOCKED); INIT_WORK(&ctx->exit_work, io_ring_exit_work); - queue_work(system_wq, &ctx->exit_work); + /* + * Use system_unbound_wq to avoid spawning tons of event kworkers + * if we're exiting a ton of rings at the same time. It just adds + * noise and overhead, there's no discernable change in runtime + * over using system_wq. + */ + queue_work(system_unbound_wq, &ctx->exit_work); } static int io_uring_release(struct inode *inode, struct file *file) |