io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: [PATCH 5/5] io_uring: kill extra wake_up_process in tw add
Date: Wed,  8 Sep 2021 16:40:53 +0100	[thread overview]
Message-ID: <7e90cf643f633e857443e0c9e72471b221735c50.1631115443.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1631115443.git.asml.silence@gmail.com>

TWA_SIGNAL already wakes the thread, no need in wake_up_process() after
it.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3d911f8808bf..9dfc243ade9e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2196,8 +2196,9 @@ static void io_req_task_work_add(struct io_kiocb *req)
 	 * will do the job.
 	 */
 	notify = (req->ctx->flags & IORING_SETUP_SQPOLL) ? TWA_NONE : TWA_SIGNAL;
-	if (!task_work_add(tsk, &tctx->task_work, notify)) {
-		wake_up_process(tsk);
+	if (likely(!task_work_add(tsk, &tctx->task_work, notify))) {
+		if (notify == TWA_NONE)
+			wake_up_process(tsk);
 		return;
 	}
 
-- 
2.33.0


      parent reply	other threads:[~2021-09-08 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 15:40 [PATCH 0/5 for-next] small for-next optimisations Pavel Begunkov
2021-09-08 15:40 ` [PATCH 1/5] io_uring: kill off ios_left Pavel Begunkov
2021-09-08 15:40 ` [PATCH 2/5] io_uring: inline io_dismantle_req Pavel Begunkov
2021-09-08 15:40 ` [PATCH 3/5] io_uring: inline linked part of io_req_find_next Pavel Begunkov
2021-09-08 15:40 ` [PATCH 4/5] io_uring: dedup CQE flushing non-empty checks Pavel Begunkov
2021-09-08 15:40 ` Pavel Begunkov [this message]

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=7e90cf643f633e857443e0c9e72471b221735c50.1631115443.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --subject='Re: [PATCH 5/5] io_uring: kill extra wake_up_process in tw add' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).