io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up
RFC PATCH 1/1 io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up
When poll thread is waken up, should clear all ctxes' IORING_SQ_NEED_WAKEUP flag, otherwise apps will always enter kernel to submit reqs.
Fixes df033a30aaee ("io_uring: set ctx need-wakeup flag when SQPOLL thread is going idle")
Signed-off-by Xiaoguang Wang <[email protected]>
--- fs/io_uring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/io_uring.c +4 -2
@@ -6849,12 +6849,14 @@ static int io_sq_thread(void *data)io_run_task_work ();cond_resched (); }else if (ret ==SQT_IDLE ) { -list_for_each_entry (ctx, &sqd->ctx_list, sqd_list) -io_ring_set_wakeup_flag (ctx);if (kthread_should_park ())continue ; +list_for_each_entry (ctx, &sqd->ctx_list, sqd_list) +io_ring_set_wakeup_flag (ctx);schedule (); start_jiffies = jiffies; +list_for_each_entry (ctx, &sqd->ctx_list, sqd_list) +io_ring_clear_wakeup_flag (ctx); } }
Signature · 1 line
2.17.2
Jens Axboe
maintainerQuoted 2 lines · Xiaoguang Wang
When poll thread is waken up, should clear all ctxes'
IORING_SQ_NEED_WAKEUPflag, otherwise apps will always enter kernel to submit reqs.
Thanks, I'm going to fold this in, as I folded in the referenced fix as well.
Signature · 1 line
Jens Axboe