public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 1/6] io_uring: small optimisation of tctx_task_work
Date: Mon, 21 Mar 2022 22:02:19 +0000	[thread overview]
Message-ID: <c6765c804f3c438591b9825ab9c43d22039073c4.1647897811.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

There should be no completions stashed when we first get into
tctx_task_work(), so move completion flushing checks a bit later
after we had a chance to execute some task works.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 1a65d7880440..bb8a1362cb5e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2492,10 +2492,6 @@ static void tctx_task_work(struct callback_head *cb)
 	while (1) {
 		struct io_wq_work_node *node1, *node2;
 
-		if (!tctx->task_list.first &&
-		    !tctx->prior_task_list.first && uring_locked)
-			io_submit_flush_completions(ctx);
-
 		spin_lock_irq(&tctx->task_lock);
 		node1 = tctx->prior_task_list.first;
 		node2 = tctx->task_list.first;
@@ -2509,10 +2505,13 @@ static void tctx_task_work(struct callback_head *cb)
 
 		if (node1)
 			handle_prev_tw_list(node1, &ctx, &uring_locked);
-
 		if (node2)
 			handle_tw_list(node2, &ctx, &uring_locked);
 		cond_resched();
+
+		if (!tctx->task_list.first &&
+		    !tctx->prior_task_list.first && uring_locked)
+			io_submit_flush_completions(ctx);
 	}
 
 	ctx_flush_and_put(ctx, &uring_locked);
-- 
2.35.1


  reply	other threads:[~2022-03-21 22:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 22:02 [PATCH 0/6] completion path optimisations Pavel Begunkov
2022-03-21 22:02 ` Pavel Begunkov [this message]
2022-03-21 22:02 ` [PATCH 2/6] io_uring: remove extra ifs around io_commit_cqring Pavel Begunkov
2022-03-21 22:02 ` [PATCH 3/6] io_uring: refactor io_req_find_next Pavel Begunkov
2022-03-21 22:02 ` [PATCH 4/6] io_uring: optimise io_free_batch_list Pavel Begunkov
2022-03-21 22:02 ` [PATCH 5/6] io_uring: move poll recycling later in compl flushing Pavel Begunkov
2022-03-21 22:02 ` [PATCH 6/6] io_uring: clean up io_queue_next() Pavel Begunkov
2022-03-22  2:52 ` [PATCH 0/6] completion path optimisations 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=c6765c804f3c438591b9825ab9c43d22039073c4.1647897811.git.asml.silence@gmail.com \
    [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