All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ali Nasrolahi <a.nasrolahi01@gmail.com>
To: Foxie Flakey <foxieflakey@gmail.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: [PATCH] userfaultfd: reset err when move_pages_ptes succeeded
Date: Sat, 15 Aug 2026 19:20:30 +0330	[thread overview]
Message-ID: <aoCJXlrOG3VvCGLt@zephyr> (raw)
In-Reply-To: <80b30bbd-dfa0-e8b9-0af3-e89116a464fe@gmail.com>

On 26/08/15 09:13PM, Foxie Flakey wrote:
> 
> 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
> 
> 

Hi,

Use `./scripts/get_maintainer.pl <file>` to figure out to which mailing
list you should send your patches. Also don't forget to CC the subsytem
and the file maintainer. I don't think this is the correct mailing list
for your patch :)

Cheers,
    Ali

  reply	other threads:[~2026-08-15 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-15 14:13 [PATCH] userfaultfd: reset err when move_pages_ptes succeeded Foxie Flakey
2026-08-15 15:50 ` Ali Nasrolahi [this message]
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=aoCJXlrOG3VvCGLt@zephyr \
    --to=a.nasrolahi01@gmail.com \
    --cc=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.