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], [email protected]
Subject: [PATCH for-next 3/4] io_uring/rsrc: optimise single entry advance
Date: Wed, 22 Feb 2023 14:36:50 +0000	[thread overview]
Message-ID: <aca3d68af0a5e1e463c95ceb2d98202b3eb57025.1677041932.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Iterating within the first bvec entry should be essentially free, but we
use iov_iter_advance() for that, which shows up in benchmark profiles
taking up to 0.5% of CPU. Replace it with a hand coded version.

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

diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 53845e496881..ebbd2cea7582 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -1364,7 +1364,10 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
 		const struct bio_vec *bvec = imu->bvec;
 
 		if (offset <= bvec->bv_len) {
-			iov_iter_advance(iter, offset);
+			iter->bvec = bvec;
+			iter->nr_segs = bvec->bv_len;
+			iter->count -= offset;
+			iter->iov_offset = offset;
 		} else {
 			unsigned long seg_skip;
 
-- 
2.39.1


  parent reply	other threads:[~2023-02-22 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 14:36 [PATCH for-next 0/4] io_uring: registered huge buffer optimisations Pavel Begunkov
2023-02-22 14:36 ` [PATCH for-next 1/4] io_uring/rsrc: disallow multi-source reg buffers Pavel Begunkov
2023-02-22 14:36 ` [PATCH for-next 2/4] io_uring/rsrc: fix a comment in io_import_fixed() Pavel Begunkov
2023-02-22 14:36 ` Pavel Begunkov [this message]
2023-02-22 14:36 ` [PATCH for-next 4/4] io_uring/rsrc: optimise registered huge pages Pavel Begunkov
2023-03-16 12:12   ` Mark Rutland
2023-03-16 12:26     ` Pavel Begunkov
2023-02-22 17:48 ` (subset) [PATCH for-next 0/4] io_uring: registered huge buffer 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=aca3d68af0a5e1e463c95ceb2d98202b3eb57025.1677041932.git.asml.silence@gmail.com \
    [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