* [PATCH v2] userfaultfd: reset err to be 0 when move_pages_ptes succeeded
@ 2026-08-18 1:44 Foxie Flakey
2026-08-18 1:54 ` Foxie Flakey
0 siblings, 1 reply; 2+ messages in thread
From: Foxie Flakey @ 2026-08-18 1:44 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, Suren Baghdasaryan
Cc: linux-mm, linux-kernel
From 2599b924548175bef41ca6a601de58236a55a998 Mon Sep 17 00:00:00 2001
From: Foxie Flakey <foxieflakey@gmail.com>
Date: Sun, 16 Aug 2026 23:03:46 +0700
Subject: [PATCH] userfaultfd: reset err to be 0 when move_pages_ptes succeeded
During move_pages() operation, when move_pages_ptes() returns EAGAIN,
the error code is not cleared even after we processed it. This leads
to a successful retry but then the same pages are retried again due to
the stale error code. This time move fails because pages are already
moved, loop is terminated and move_pages() reports a failure.
Clear the error code once we processes EAGAIN.
Fixes: 50944692052b ("userfaultfd: opportunistic TLB-flush batching for present pages in MOVE")
Assisted-by: ChatGPT:GPT-5.6-Luna
Signed-off-by: Foxie Flakey <foxieflakey@gmail.com>
---
Changes in v2:
- Updated on description to be easier to understood
- Reset err before retrying, instead of fixing right at the move_pages_ptes
branch.
- Added Assisted-by, received an answer few days ago from linux-newbies IRC
that even I just used AI/LLM as "fast path" of git bisect. I still need
to add it following
https://docs.kernel.org/process/coding-assistants.html doc.
---
mm/userfaultfd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index c3adedaaf7d5..ec5d511bd179 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -2085,8 +2085,10 @@ static ssize_t move_pages(struct userfaultfd_ctx *ctx, unsigned long dst_start,
}
if (err) {
- if (err == -EAGAIN)
+ if (err == -EAGAIN) {
+ err = 0;
continue;
+ }
break;
}
base-commit: 62cc90241548d5570ee68e01aaba6506964e9811
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] userfaultfd: reset err to be 0 when move_pages_ptes succeeded
2026-08-18 1:44 [PATCH v2] userfaultfd: reset err to be 0 when move_pages_ptes succeeded Foxie Flakey
@ 2026-08-18 1:54 ` Foxie Flakey
0 siblings, 0 replies; 2+ messages in thread
From: Foxie Flakey @ 2026-08-18 1:54 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, Suren Baghdasaryan
Cc: linux-mm, linux-kernel
Not sure where I put text that is not the patch description and not in
changes. I put this on seperate mail reply.
On Tue, 18 Aug 2026, Foxie Flakey wrote:
> During move_pages() operation, when move_pages_ptes() returns EAGAIN,
> the error code is not cleared even after we processed it. This leads
> to a successful retry but then the same pages are retried again due to
> the stale error code. This time move fails because pages are already
> moved, loop is terminated and move_pages() reports a failure.
> Clear the error code once we processes EAGAIN.
>
> Fixes: 50944692052b ("userfaultfd: opportunistic TLB-flush batching for present pages in MOVE")
> Assisted-by: ChatGPT:GPT-5.6-Luna
> Signed-off-by: Foxie Flakey <foxieflakey@gmail.com>
I'll delay figuring what to do with Signed-off-by, I'd rather keep Foxie
Flakey because that what is my "known identity" on internet at various
places like GitHub, Alpine's GitLab and now here in Linux kernel
development. Would be nice if I can keep Foxie Flakey, like again policy is
policy not a suggestion if Foxie Flakey is not allowed.
> ---
> Changes in v2:
> - Updated on description to be easier to understood
> - Reset err before retrying, instead of fixing right at the move_pages_ptes
> branch.
> - Added Assisted-by, received an answer few days ago from linux-newbies IRC
> that even I just used AI/LLM as "fast path" of git bisect. I still need
> to add it following
> https://docs.kernel.org/process/coding-assistants.html doc.
Would be nice to not have to add this Assisted-by. Mainly because I just
used ChatGPT as "fast path" of git bisect to avoid needing recompiling
kernels during bisect if ChatGPT found result first before I finished git
bisect. I feel like my effort trying to understand how to mail, write
patches is undermined, but policy is policy so I don't mind if it has to
stay.
> ---
> mm/userfaultfd.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> index c3adedaaf7d5..ec5d511bd179 100644
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -2085,8 +2085,10 @@ static ssize_t move_pages(struct userfaultfd_ctx *ctx, unsigned long dst_start,
> }
>
> if (err) {
> - if (err == -EAGAIN)
> + if (err == -EAGAIN) {
> + err = 0;
> continue;
> + }
> break;
> }
>
>
> base-commit: 62cc90241548d5570ee68e01aaba6506964e9811
> --
> 2.55.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-18 1:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 1:44 [PATCH v2] userfaultfd: reset err to be 0 when move_pages_ptes succeeded Foxie Flakey
2026-08-18 1:54 ` Foxie Flakey
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.