From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A076E359A7C for ; Thu, 2 Apr 2026 04:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775102567; cv=none; b=ccitVlJfUHX+IAG4WM8L29i4TPztStX4tAEWFx/1Gsd4TxB0ZaqV8GS/UzkqvGmUlcD2T24Q74NrIX8M0pEozw9UQ17KJ96Y4LLODZjfMb0sopt6tl524/IN3e3RtUKi9RSQGkPuv615hQKbvml+moHgRt/uyrS7uO3cBj5ZN3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775102567; c=relaxed/simple; bh=9+/dwINtJN/cpLno+AS/FdsNHwehhVrZYUkBkuZRdV0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OOCaTWF+9ZvpVa7q4NCeYUY8MwwbfBbSaCj7wLissf0kfSMvm4purstutHL7QWrfpAX4Zzbs9KBu/WWy9R1moTlXAuzJ1YJmDpi7nTsnwHCDFHynhdPd4bVkQcCQCcxuW1s4eHtkGVIYK6qsUhMOFnVuN2/TDEfq36kLT33leJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eiA0a3IG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eiA0a3IG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10346C19423; Thu, 2 Apr 2026 04:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775102567; bh=9+/dwINtJN/cpLno+AS/FdsNHwehhVrZYUkBkuZRdV0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eiA0a3IGgNwJ4HH3TnA6dyjb9dEiE9csmalxo3g235EFn4BNVs1OVmMMFeA7ns8Y6 6B5y4hj47Lgh0IVXGvpD7kIqbLP0/cclM1/3/8lXLq9PAaAOL+dBoMsUMZ3Iuc1frV 2VZhWJrO/voB3qaPoleaiUt38LLLJNw+Md1flLGM7wtGyNKYxKqBBsK6ea3zn+lrce +b3HT6pWP6ffo5oBbPB0VRsnxc0OYfj8XXm9GcGKoCn2ztxOKLry7K4s43bdVd9TZK G+Aq430kB4cIf+ZFWQGpUVSNGwEb3CALBTyXu/xpmzv3z1TPHD1R1JpO0xdoi8CAT3 AS7Vs94KysHaQ== Date: Thu, 2 Apr 2026 07:02:40 +0300 From: Mike Rapoport To: Peter Xu Cc: David CARLIER , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka Subject: Re: [PATCH v4] mm/userfaultfd: detect VMA replacement after copy retry in mfill_copy_folio_retry() Message-ID: References: <20260331134158.622084-1-devnexen@gmail.com> <20260331200148.cc0c95deaf070579a68af041@linux-foundation.org> 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: On Wed, Apr 01, 2026 at 03:22:03PM -0400, Peter Xu wrote: > > The other thing is I just noticed the err code was changed to -EINVAL for > snapshot changed cases, sorry I didn't follow previously as closely on the > discussion. I think it should be -EAGAIN. It's because the userapp can't > resolve -EINVAL failures and app will crash. In a VMA change use case, we > should return -EAGAIN to imply the app to retry, rather than crashing. No. The return value should express that the VMA is invalid. -EINVAL could work, but looking now at the manual -ENOENT would be even better: ENOENT (since Linux 4.11) The faulting process has changed its virtual memory layout simultaneously with an outstanding UFFDIO_COPY operation. > Thanks, > -- > Peter Xu -- Sincerely yours, Mike.