public inbox for [email protected]
 help / color / mirror / Atom feed
* [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up
@ 2020-09-13 13:44 Xiaoguang Wang
  2020-09-14 23:26 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2020-09-13 13:44 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, asml.silence, joseph.qi, Xiaoguang Wang

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(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ae83d887c24d..9491f2040a93 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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);
 		}
 	}
 
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up
  2020-09-13 13:44 [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up Xiaoguang Wang
@ 2020-09-14 23:26 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-09-14 23:26 UTC (permalink / raw)
  To: Xiaoguang Wang, io-uring; +Cc: asml.silence, joseph.qi

On 9/13/20 7:44 AM, Xiaoguang Wang wrote:
> When poll thread is waken up, should clear all ctxes' IORING_SQ_NEED_WAKEUP
> flag, 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-14 23:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-13 13:44 [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up Xiaoguang Wang
2020-09-14 23:26 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox