Skip to content

Commit 22f7fb8

Browse files
committed
io_uring/io-wq: don't gate worker wake up success on wake_up_process()
All we really care about is finding a free worker. If said worker is already running, it's either starting new work already or it's just finishing up existing work. For the latter, we'll be finding this work item next anyway, and for the former, if the worker does go to sleep, it'll create a new worker anyway as we have pending items. This reduces try_to_wake_up() overhead considerably: 23.16% -10.46% [kernel.kallsyms] [k] try_to_wake_up Reviewed-by: Hao Xu <howeyxu@tencent.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent de36a15 commit 22f7fb8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

io_uring/io-wq.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,14 @@ static bool io_wq_activate_free_worker(struct io_wq *wq,
276276
io_worker_release(worker);
277277
continue;
278278
}
279-
if (wake_up_process(worker->task)) {
280-
io_worker_release(worker);
281-
return true;
282-
}
279+
/*
280+
* If the worker is already running, it's either already
281+
* starting work or finishing work. In either case, if it does
282+
* to go sleep, we'll kick off a new task for this work anyway.
283+
*/
284+
wake_up_process(worker->task);
283285
io_worker_release(worker);
286+
return true;
284287
}
285288

286289
return false;

0 commit comments

Comments
 (0)