From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C36EC3D3CF7 for ; Wed, 19 Aug 2026 06:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787122014; cv=none; b=cirn78xVbaqYSFcxgQRNcvxvmfsHPpoXsExvk2qPkcbtT8TpnIgmPJ72SFSx3qQ14zZN5jR8/RQnav8ik33X21C3HkjZ6x4uIII2LH1ydojXq9zhGte9KaoxbFbaQgw+uOfXgB4BB4Xgo2bHDAwFljHAWIWlaVB0QX4cyIUeHo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787122014; c=relaxed/simple; bh=xC0cGvSjDAteVfvnpfF9mJC8VjNxKQiSE6+MSwfJcGM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xy5z1LVu001akK3ZAwbmRuVtFOsgVhQoIuql0QuZeiUxZyrCBn7d25ANTsoCrM0GhigdTDkQ7J6EBq4AKraCP24J1vlRD0Go+mwZBcIqgzB6c2UqddnBkluWyTwA/4Mq8pQXTUkeYpumVf57aQhWWLWDQuqUaLHnXVfTkWCw5H0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iq3RJ4x3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iq3RJ4x3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F09511F000E9; Wed, 19 Aug 2026 06:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787122012; bh=6amBd88qdRH+SsKUpHOPbhpfzj9SJOQZq0zj/mskebs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=iq3RJ4x3BESaSt3EwMg8lKDJ9TzWuDwmDxda23HclYZYpF7G4+gFvA6QE31C+6TFg uubaWKu6DbJ6bZqY1aXLYdMt70Y3lfU+8QROfGMQw+00kNoCw+kjFpBvFvjUpJft5i 8IEoltZRyUpM20kYv39rlYw6tUUZLcpR+FWzXlQl5J64o8IkcDv632u9V9TsJeZ59D kNXYGIsSVhK94ikA/Q92KQuOwY5Ol8iJdzVczOWCEPUJvk7lf7nKVdgL0myCAx1sfF jE/NJf6IKd+MOKBeKSz0tjWNVDFbN7qj6jRrxuMaYwhR7o9hH8C/j9MzJGZ9v20WMa WnK102uHjrDqw== Date: Wed, 19 Aug 2026 09:46:46 +0300 From: Mike Rapoport To: Foxie Flakey Cc: Andrew Morton , Peter Xu , Suren Baghdasaryan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] userfaultfd: reset err to be 0 when move_pages_ptes succeeded Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Foxie, On Wed, Aug 19, 2026 at 10:08:24AM +0700, 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: Bryan Lim With the authorship changes that Andrew requested Acked-by: Mike Rapoport (Microsoft) > --- > Changes in v3: > - Updated to use proper sign off. > > 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; > } > > -- > 2.55.0 > -- Sincerely yours, Mike.