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 2/3] io_uring: clean io_req_find_next() fast check
Date: Fri, 12 Feb 2021 18:41:16 +0000	[thread overview]
Message-ID: <08fc9313442ea39051c4314904da8f7889cbfd99.1613154861.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1613154861.git.asml.silence@gmail.com>

Indirectly io_req_find_next() is called for every request, optimise the
check by testing flags as it was long before -- __io_req_find_next()
tolerates false-positives well (i.e. link==NULL), and those should be
really rare.

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

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 66bbb0dc50af..776531f6e18b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2172,7 +2172,7 @@ static struct io_kiocb *__io_req_find_next(struct io_kiocb *req)
 
 static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req)
 {
-	if (likely(!(req->link) && !(req->flags & REQ_F_LINK_TIMEOUT)))
+	if (likely(!(req->flags & (REQ_F_LINK|REQ_F_HARDLINK))))
 		return NULL;
 	return __io_req_find_next(req);
 }
-- 
2.24.0


  parent reply	other threads:[~2021-02-12 18:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 18:41 [PATCH 0/3] small cleanups for 5.12 Pavel Begunkov
2021-02-12 18:41 ` [PATCH 1/3] io_uring: don't check PF_EXITING from syscall Pavel Begunkov
2021-02-12 18:41 ` Pavel Begunkov [this message]
2021-02-12 18:41 ` [PATCH 3/3] io_uring: optimise io_init_req() flags setting Pavel Begunkov
2021-02-12 19:25 ` [PATCH 0/3] small cleanups for 5.12 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=08fc9313442ea39051c4314904da8f7889cbfd99.1613154861.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).