From: Foxie Flakey <foxieflakey@gmail.com>
To: linux-newbie@vger.kernel.org
Subject: [PATCH] userfaultfd: reset err when move_pages_ptes succeeded
Date: Sat, 15 Aug 2026 21:13:31 +0700 (WIB) [thread overview]
Message-ID: <80b30bbd-dfa0-e8b9-0af3-e89116a464fe@gmail.com> (raw)
There is an edge case when move_pages_ptes fails with EAGAIN and then outer
loop attempt to retry and succeeded but "err" isn't reset. This leads to
outer loop retry erroneously on same set of pages that was successfully
moved. This is fixed by resetting "err" when move_pages_ptes succeeded.
Fixes: 50944692052b ("userfaultfd: opportunistic TLB-flush batching for present pages in MOVE")
Signed-off-by: Foxie Flakey <foxieflakey@gmail.com>
Assisted-by: ChatGPT:GPT-5.6-Luna
---
mm/userfaultfd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index c3adedaaf7d5..595e7e232f90 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -2069,10 +2069,12 @@ static ssize_t move_pages(struct userfaultfd_ctx *ctx, unsigned long dst_start,
ret = move_pages_ptes(mm, dst_pmd, src_pmd,
dst_vma, src_vma, dst_addr,
src_addr, src_end - src_addr, mode);
- if (ret < 0)
+ if (ret < 0) {
err = ret;
- else
+ } else {
+ err = 0;
step_size = ret;
+ }
}
cond_resched();
base-commit: 62cc90241548d5570ee68e01aaba6506964e9811
--
2.55.0
next reply other threads:[~2026-08-15 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 14:13 Foxie Flakey [this message]
2026-08-15 15:50 ` [PATCH] userfaultfd: reset err when move_pages_ptes succeeded Ali Nasrolahi
2026-08-15 16:05 ` Foxie Flakey
-- strict thread matches above, loose matches on Subject: below --
2026-08-15 14:11 Foxie Flakey
2026-08-15 12:34 Foxie Flakey
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=80b30bbd-dfa0-e8b9-0af3-e89116a464fe@gmail.com \
--to=foxieflakey@gmail.com \
--cc=linux-newbie@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 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.