All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	mm-commits@vger.kernel.org, viro@zeniv.linux.org.uk,
	stable@vger.kernel.org, ryan@lahfa.xyz, maximilian@mbosch.me,
	ct@flyingcircus.io, brauner@kernel.org, arnout@bzzt.net
Subject: Re: + iov_iter-iterate_folioq-fix-handling-of-offset-=-folio-size.patch added to mm-hotfixes-unstable branch
Date: Wed, 13 Aug 2025 06:20:13 +0900	[thread overview]
Message-ID: <aJuwDfwoSUP_M_0D@codewreck.org> (raw)
In-Reply-To: <650364.1754991487@warthog.procyon.org.uk>

David Howells wrote on Tue, Aug 12, 2025 at 10:38:07AM +0100:
> > @@ -168,6 +168,8 @@ size_t iterate_folioq(struct iov_iter *i
> >  			break;
> >  
> >  		fsize = folioq_folio_size(folioq, slot);
> > +		if (skip < fsize) {
> >  		base = kmap_local_folio(folio, skip);
> >  		part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
> >  		remain = step(base, progress, part, priv, priv2);
> > @@ -177,6 +179,7 @@ size_t iterate_folioq(struct iov_iter *i
> >  		progress += consumed;
> >  		skip += consumed;
> > +		}
> >  		if (skip >= fsize) {
> >  			skip = 0;
> >  			slot++;
> >  			if (slot == folioq_nr_slots(folioq) && folioq->next) {
> 
> With the stuff inside the braces suitably indented.  The compiler should be
> able to optimise away the extra comparison.

skip is modified in the first if so I don't see how the compiler could
optimize it.
I just checked and at least iov_iter.o is slightly bigger with a second if:

(a.o = goto, b.o = if)
06:17:52 asmadeus@thor 0 ~/code/linux/bb$ size a.o b.o
   text	  data	   bss	   dec	   hex	filename
  26923	  1104	     0	 28027	  6d7b	a.o
  27019	  1104	     0	 28123	  6ddb	b.o

but honestly I'm happy to focus on readability here -- if you think two
if are easier to read I'll be happy to send a v3

-- 
Dominique Martinet | Asmadeus

  reply	other threads:[~2025-08-12 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  1:02 + iov_iter-iterate_folioq-fix-handling-of-offset-=-folio-size.patch added to mm-hotfixes-unstable branch Andrew Morton
2025-08-12  9:38 ` David Howells
2025-08-12 21:20   ` Dominique Martinet [this message]
2025-08-12 21:38     ` David Howells
2025-08-13  6:00       ` Dominique Martinet
  -- strict thread matches above, loose matches on Subject: below --
2025-08-13 23:15 Andrew Morton

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=aJuwDfwoSUP_M_0D@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnout@bzzt.net \
    --cc=brauner@kernel.org \
    --cc=ct@flyingcircus.io \
    --cc=dhowells@redhat.com \
    --cc=maximilian@mbosch.me \
    --cc=mm-commits@vger.kernel.org \
    --cc=ryan@lahfa.xyz \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.