[RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <xiaoguang.wang@xxxxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux