Skip to content

Commit dd432ea

Browse files
isilenceaxboe
authored andcommitted
io_uring: mainstream sqpoll task_work running
task_works are widely used, so place io_run_task_work() directly into the main path of io_sq_thread(), and remove it from other places where it's not needed anymore. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/24eb5e35d519c590d3dffbd694b4c61a5fe49029.1624739600.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent b2d9c3d commit dd432ea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fs/io_uring.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6868,7 +6868,6 @@ static bool io_sqd_handle_event(struct io_sq_data *sqd)
68686868
cond_resched();
68696869
mutex_lock(&sqd->lock);
68706870
}
6871-
io_run_task_work();
68726871
return did_sig || test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
68736872
}
68746873

@@ -6897,7 +6896,6 @@ static int io_sq_thread(void *data)
68976896
if (io_sqd_handle_event(sqd))
68986897
break;
68996898
timeout = jiffies + sqd->sq_thread_idle;
6900-
continue;
69016899
}
69026900

69036901
cap_entries = !list_is_singular(&sqd->ctx_list);
@@ -6907,17 +6905,18 @@ static int io_sq_thread(void *data)
69076905
if (!sqt_spin && (ret > 0 || !list_empty(&ctx->iopoll_list)))
69086906
sqt_spin = true;
69096907
}
6908+
if (io_run_task_work())
6909+
sqt_spin = true;
69106910

69116911
if (sqt_spin || !time_after(jiffies, timeout)) {
6912-
io_run_task_work();
69136912
cond_resched();
69146913
if (sqt_spin)
69156914
timeout = jiffies + sqd->sq_thread_idle;
69166915
continue;
69176916
}
69186917

69196918
prepare_to_wait(&sqd->wait, &wait, TASK_INTERRUPTIBLE);
6920-
if (!io_sqd_events_pending(sqd) && !io_run_task_work()) {
6919+
if (!io_sqd_events_pending(sqd) && !current->task_works) {
69216920
bool needs_sched = true;
69226921

69236922
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {

0 commit comments

Comments
 (0)