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 326EF3C1963 for ; Wed, 19 Aug 2026 03:26:57 +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=1787110019; cv=none; b=GdOb36CbHo2YuTz9eMi32c/ZKf5F/3P5QfMsVDKySfv5crk49wEXsGzBuxnREOIGH6Q8VvckRd7AmPJNm+tXXjvlUVOFlwTQROy48L6CwBAA03/ruFVllo/PxyjaxKzGF3sXd4+EfccO+w6YrREu1LKRXSxvvaMEUYaZ+r/Wxng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787110019; c=relaxed/simple; bh=Reg+baIGfDQAuH15Cy39q39SvHBVdh+GeQidYdE9jDg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=CdENw7ilehDjzUq79vUkqUi1ddSYVtpwtNCku7hjUI2Nk2za6jMRCNuv/BsfB76+PyfDYCTekXfeFciwS7xIHfxvNVkBAL+BjNagFOjmrq1M07EAZgxdARkf3SJS+jPijcMKQikOaTdxoMC7CmV0f6HM0QCsyNQW+/k7UHeDxBo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=IVOBb5xL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="IVOBb5xL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55A191F000E9; Wed, 19 Aug 2026 03:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1787110017; bh=DZsR5sCGflKVZsWluYOj7yhh9p4oVHlhw6wAcEQCGCw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=IVOBb5xLR1QWeHHyFIp07pXoOjRkmb5kH1NbLK7HXNbjx7bAtJgGk1uxE1ho3RaSS FZrAX8RDckayMIYgBSLQmXglvM9NPhEy5Yhl5k8WbY0T2gk2Vk4OURTuQq1HqAKe3Y 30Wl9nEjJPf16sjghMpQ7nOcEnGDuijTHmFNNX5o= Date: Tue, 18 Aug 2026 20:26:56 -0700 From: Andrew Morton To: Foxie Flakey Cc: Mike Rapoport , 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: <20260818202656.f7a248b33f6130d06b4cf83e@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Wed, 19 Aug 2026 10:08:24 +0700 (WIB) 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 Thanks, Bryan. More paperwork: the signoff is supposed to match the Author:. The way to do this is to add an explicit From: line at start-of-changelog. If this is not present, we fall back to the email envelope's From:. > --- 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; > } I'll queue it, with an adjusted From:, as above. Could reviewers please advise on whether we should backport this into -stable kernels?