public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: huang-jl <huang-jl@deepseek.com>
Cc: axboe@kernel.dk, csander@purestorage.com,
	io-uring@vger.kernel.org, nj.shetty@samsung.com
Subject: Re: [PATCH v6.20] io_uring/rsrc: refactor io_import_kbuf() to use single loop
Date: Thu, 18 Dec 2025 10:27:57 +0800	[thread overview]
Message-ID: <aUNmrSVkZEMk7xmF@fedora> (raw)
In-Reply-To: <aUNcE48RnCy_rFQj@fedora>

On Thu, Dec 18, 2025 at 09:42:43AM +0800, Ming Lei wrote:
> On Wed, Dec 17, 2025 at 11:16:47PM +0800, huang-jl wrote:
> > The code looks correct to me.
> > 
> > > This simplifies the logic
> > 
> > I'm not an expert in Linux development, but from my perspective, the
> > original version seems simpler and more readable. The semantics of
> > iov_iter_advance() are clear and well-understood.
> > 
> > That said, I understand the appeal of merging them into a single loop.
> > 
> > > and avoids the overhead of iov_iter_advance()
> > 
> > Could you clarify what overhead you mean? If it's the function call
> > overhead, I think the compiler would inline it anyway. The actual
> > iteration work seems equivalent between both approaches.
> 
> iov_iter_advance() is global function, and it can't be inline.
> 
> Also single loop is more readable, cause ->iov_offset can be ignored easily.
> 
> In theory, re-calculating nr_segs isn't necessary, it is just for avoiding
> potential split, however not get idea how it is triggered. Nitesh didn't
> mention the exact reason:
> 
> https://lkml.org/lkml/2025/4/16/351
> 
> I will look at the reason and see if it can be avoided.

The reason is in both bio_iov_bvec_set() and bio_may_need_split().

->bi_vcnt doesn't make sense for cloned bio, and shouldn't be used as multiple
segment hint.

However, it also shows bio_split_rw() is too heavy.


Thanks,
Ming


  reply	other threads:[~2025-12-18  2:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17 12:31 [PATCH v6.20] io_uring/rsrc: refactor io_import_kbuf() to use single loop Ming Lei
2025-12-17 15:16 ` huang-jl
2025-12-18  1:42   ` Ming Lei
2025-12-18  2:27     ` Ming Lei [this message]
2025-12-18  3:19       ` huang-jl
2025-12-22 19:56       ` Caleb Sander Mateos
2025-12-23  2:30         ` Ming Lei
2025-12-23 19:56           ` Caleb Sander Mateos
2025-12-23 22:45             ` Ming Lei

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=aUNmrSVkZEMk7xmF@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=huang-jl@deepseek.com \
    --cc=io-uring@vger.kernel.org \
    --cc=nj.shetty@samsung.com \
    /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