Skip to content

Commit 8343cae

Browse files
committed
io_uring/io-wq: ignore non-busy worker going to sleep
When an io-wq worker goes to sleep, it checks if there's work to do. If there is, it'll create a new worker. But if this worker is currently idle, it'll either get woken right back up immediately, or someone else has already created the necessary worker to handle this work. Only go through the worker creation logic if the current worker is currently handling a work item. That means it's being scheduled out as part of handling that work, not just going to sleep on its own. Signed-off-by: Jens Axboe <[email protected]>
1 parent e37dfc0 commit 8343cae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/io-wq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ static void io_wq_dec_running(struct io_worker *worker)
429429

430430
if (!atomic_dec_and_test(&acct->nr_running))
431431
return;
432+
if (!worker->cur_work)
433+
return;
432434
if (!io_acct_run_queue(acct))
433435
return;
434436

0 commit comments

Comments
 (0)