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 668153932F7 for ; Thu, 30 Jul 2026 07:44:06 +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=1785397449; cv=none; b=bf6QjIy6jfGeG3DMMke3jK/SvUCdaQvPR6oaiHzANJmBgP1OudpeqYHnk64jmOFIg7OClVT+ght0jEF4f6IYLlU92SRnjSfEarGHiTpbq6TYzeTbeGo1yuuzeT7vCKOCuYKZjBCsUd+aN2qvKTN1CxZ7WTdM9L7hXVa/Y9e5LaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785397449; c=relaxed/simple; bh=VmeKQuTAIg63rX0NYBXbKDYna+Q8UGjCgnzC2xARrSA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XGcZrXSXgUb5sE2mKtRLwsMgBnKFMpywC+8569p3WAXdTTu4BVU5XLhxPWGw48u/uCk9i05YhG1aiBtj29gRauATYBYRtsdwHmL7axAQz9bIsRw2PX8OrirAetVxvWyEHLejee1HRt/jqO05NjhDASQFbSy9yUD+EUUflbIBO1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dyexTZr7; 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="dyexTZr7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0C191F000E9; Thu, 30 Jul 2026 07:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785397446; bh=VmeKQuTAIg63rX0NYBXbKDYna+Q8UGjCgnzC2xARrSA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dyexTZr7da33+SkLZ0GI0SbNJvBfORKTgm8yfOBmfz8iGrTDWWsw8Y8Z2fCFLVPcF 0ZarFBhp7DMmE8435CHEMiEl/7zjR8gYqu6Pza3f+S0ozGBLBfnGW5EjXNlWfgF/A0 SV7iN6DwqE7qTGI/MLWuyfXDz7dEFGS2x0efJItpFulFivamRtOOp2pQ7q1yJZ2oWK EU4tUbmLCjChZqZ2xA8e5JzXCOpSmi9zp5L1bGasD9W+xAorkqRksxprv1MjiHBi97 gSVysbKzuciRksGc2RbgH5/MKohorXKr+NYG96a6Gui0vyPHtXGczbW8xV0Yq21toq uKzRs7OGAvV1Q== Date: Thu, 30 Jul 2026 08:43:48 +0100 From: "Lorenzo Stoakes (ARM)" To: Avi Weiss Cc: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Soheil Hassas Yeganeh , Arjun Roy , Eric Dumazet , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: return -ENOMEM for page-table allocation failure in insert_pages() Message-ID: References: <20260730071323.964321-1-thnkslprpt@gmail.com> 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 Thu, Jul 30, 2026 at 08:42:55AM +0100, Lorenzo Stoakes (ARM) wrote: > On Thu, Jul 30, 2026 at 10:13:23AM +0300, Avi Weiss wrote: > > walk_to_pmd() returns NULL only when p4d_alloc(), pud_alloc(), or > > pmd_alloc() fails. These are page-table allocation failures, but > > insert_pages() currently reports them as -EFAULT. > > > > Return -ENOMEM instead, consistent with the subsequent pte_alloc() > > failure and with the single-page insert_page() path, which reports > > failure of the same page-table allocation chain as -ENOMEM. > > > > Address and range validation failures in vm_insert_pages() continue to > > return -EFAULT. Keep the later -EFAULT return for > > pte_offset_map_lock(), which is not an allocation failure. > > > > Fixes: 8cd3984d81d5 ("mm/memory.c: add vm_insert_pages()") > > Hmm :) > > This isn't really a fix. Anybody relying on this returning -ENOMEM > vs. -EFAULT here is in a state of sin anyway (unless you can point to > specific users who are broken). > > Drop the tag. > > > Signed-off-by: Avi Weiss > > This is correct, walk Ugh incomplete thought :) -> This is correct, the 'walk' can only fail due to failure to allocate. Anyway I gave you a bunch of stuff to do here, respin once you've addressed all that. Cheers, Lorenzo