public inbox for [email protected]
 help / color / mirror / Atom feed
From: Xiaoguang Wang <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
	[email protected],
	Xiaoguang Wang <[email protected]>
Subject: [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up
Date: Sun, 13 Sep 2020 21:44:27 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

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


             reply	other threads:[~2020-09-13 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 13:44 Xiaoguang Wang [this message]
2020-09-14 23:26 ` [RFC PATCH for-next] io_uring: clear IORING_SQ_NEED_WAKEUP for all ctxes accordingly when waken up Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200913134427.1592-1-xiaoguang.wang@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox