Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>, asmadeus@codewreck.org
Cc: dhowells@redhat.com, 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: Tue, 12 Aug 2025 10:38:07 +0100	[thread overview]
Message-ID: <650364.1754991487@warthog.procyon.org.uk> (raw)
In-Reply-To: <20250812010237.B52F8C4CEED@smtp.kernel.org>

Thinking about it again, I think this:

> @@ -168,6 +168,8 @@ size_t iterate_folioq(struct iov_iter *i
>  			break;
>  
>  		fsize = folioq_folio_size(folioq, slot);
> +		if (skip >= fsize)
> +			goto next;
>  		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) {
> +next:
>  			skip = 0;
>  			slot++;
>  			if (slot == folioq_nr_slots(folioq) && folioq->next) {

Would be much better done as:

> @@ -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.

David


  reply	other threads:[~2025-08-12  9:38 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 [this message]
2025-08-12 21:20   ` Dominique Martinet
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=650364.1754991487@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnout@bzzt.net \
    --cc=asmadeus@codewreck.org \
    --cc=brauner@kernel.org \
    --cc=ct@flyingcircus.io \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox