aboutsummaryrefslogtreecommitdiffstats
diff options
authorJens Axboe <axboe@kernel.dk>2025-05-23 06:05:37 -0600
committerJens Axboe <axboe@kernel.dk>2025-05-23 06:14:07 -0600
commit8343cae362e147a5d4505c2da0e161a4d9e9fbde (patch)
tree598521d756060531b0db05c4bb337ad85b8240ca
parente37dfc0530815ead6e8ddab2a4ccce3be31af954 (diff)
downloadipsec-8343cae362e147a5d4505c2da0e161a4d9e9fbde.tar.gz
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 <axboe@kernel.dk>
-rw-r--r--io_uring/io-wq.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index d36d0bd9847de8..c4af99460399d7 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -429,6 +429,8 @@ static void io_wq_dec_running(struct io_worker *worker)
if (!atomic_dec_and_test(&acct->nr_running))
return;
+ if (!worker->cur_work)
+ return;
if (!io_acct_run_queue(acct))
return;