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 220273B5301 for ; Thu, 30 Jul 2026 08:36:43 +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=1785400605; cv=none; b=dpacNNFrc2PQ9qhnCDJYfYmyZx/oTDoDJBL7LrnfM+P0hdKWL1xDFqfdE7HdLnpK6Gvkzg/rFROGFXj3aDBYpQKVDMTC2yB9TLeoFNMMD0NjLBqfFxSfH6oGh2emQ2kjK5qXRZftoEBKiYafS7eXxRRyBJzxdJ6mFv/tQExSq3Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785400605; c=relaxed/simple; bh=SAoHoq3DgfZLRDw35Z4xYhIcQGEQD0G4Y9zF022oTws=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z2mygDHeynmnrjqEg5QpYWWFBK/Ta9tzG3LfoSdGoqHxf77CqUmL1blBh6HEalSZVcqDYJk7lnyecw1ZRA0LNI1bdXGoREd0dWcnMa8igD7XwkK1PvD61Tnk/LbAR9d24w+5hyOxrZiBy1CM4sWSFGccdTbrjYftXzM4oi7S7kw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VQ99kRrI; 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="VQ99kRrI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D199B1F000E9; Thu, 30 Jul 2026 08:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785400603; bh=SAoHoq3DgfZLRDw35Z4xYhIcQGEQD0G4Y9zF022oTws=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=VQ99kRrIZv2Kvo2ELjHSiiuvEwpH+BCGYyNpROcwvGBoPbO0HXL3uivv/2oeraeFG /T8xoZZszMKR2fec+pR8tHCZIoAp66ni6A1Xlgxo+zt9RbDNulUXk3De+cVY52c09p QkPkSZEhmD2/3IvaY8WT/FkItFmSk7aDXJpBaj5LK4kb+BBnpnqVlAPmj5totAFJ0L YPIHpmaDlN7nkVJ4PKnAqVbDdIHWMKexrvUkVlK1zmLYr96iadYAwnwfXEuVtDkSsg /c4fZlMmmODrUQSoZmiqihBGmccxm9wmCJDMuWIIUleHRZbXB6YX5ptuvQK/Y1Mx04 LAUmzEpFye9cQ== Date: Thu, 30 Jul 2026 09:36:25 +0100 From: "Lorenzo Stoakes (ARM)" To: "David Hildenbrand (Arm)" Cc: Avi Weiss , Andrew Morton , "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> <2a84e37c-407b-437c-a908-56526ce86322@kernel.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: <2a84e37c-407b-437c-a908-56526ce86322@kernel.org> On Thu, Jul 30, 2026 at 10:27:20AM +0200, David Hildenbrand (Arm) wrote: > On 7/30/26 09:42, 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). > > Agreed, I am missing the problem here? Seems just a cleanup, I gave Avi some ideas ;) this function could do with it. > > -- > Cheers, > > David Cheers, Lorenzo