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 35AD339B95D for ; Wed, 29 Apr 2026 06:53:35 +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=1777445616; cv=none; b=JNFZdQx9Dpnl9tXoqrerXQmX17QUspMoL6rR5F29iwDRuTrSWdpN9D/PhiGxi8ge+nzsGbwfuZ/mQo9P7ujnwLKUPWtUZ9ELjfxysrqGiMQxgNYs9vSisqbX87la/tSoOnkUQodvqKLTWZmRxANVIvHSm4Wanyxo9/GQT1qMTzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777445616; c=relaxed/simple; bh=ry4QTtQg8gXjbztYVBm6zJYokjTwMcboL55Qdm43+vE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hXewCNb2B+GrDT4p9UTHNdOSo/vEoXOYjcpo5XqTCIz1UO4kPccZ46lLZAsuXildC1mX09mSj1EhbROpaoyYk3jurBXw2+CO+0wGSLtxXixOVU9YezrXL/ImcCKyXDAwYIgu4OeB5t1tyBNWwR/wqjLvvZPqK+3TGKPbpuPO9DI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B6o7uOCV; 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="B6o7uOCV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70ACCC19425; Wed, 29 Apr 2026 06:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777445615; bh=ry4QTtQg8gXjbztYVBm6zJYokjTwMcboL55Qdm43+vE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B6o7uOCVUGVofvTMhOIRKEpYQrDDYTS40KrJjZi1lZcjCMWOmBvECYESWQWo2FVEm CHgBOcMLdJr+CPQ9pEgOcUNxvZ0eJonTtXQ1ivm9OO4VTt9xQrU7ffBl3GntJgk9jJ N6zPTFijjshuRS327HvfZssZt7OhHRanMs8zr0NXFlTvbmDSz/8t+Oyw/dxAIS5XBl WQz2fBkof+CazOSWappmrULhQbSwMfZfv4+C0djEyjZDHCHzmVU5jlOMGG2ggTX8jD evzy9JnKbuFXrAYVJ/RJPq6+lbLGkAdZW//k3DqHjytTypZiqpjWUR78XvjEllPR6y XUBdn9/v7X7gA== Date: Wed, 29 Apr 2026 08:53:25 +0200 From: Mike Rapoport To: Muchun Song Cc: Muchun Song , Andrew Morton , David Hildenbrand , Oscar Salvador , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/49] mm: panic on memory allocation failure in sparse_init_nid() Message-ID: References: <20260405125240.2558577-1-songmuchun@bytedance.com> <20260405125240.2558577-10-songmuchun@bytedance.com> <9FD13495-58E8-4183-AAC0-48E50A694ADE@linux.dev> <408EDCB4-7F65-4595-BE44-E23300FBD397@linux.dev> 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: <408EDCB4-7F65-4595-BE44-E23300FBD397@linux.dev> On Wed, Apr 29, 2026 at 11:14:14AM +0800, Muchun Song wrote: > > On Apr 28, 2026, at 21:08, Mike Rapoport wrote: > >>>> > >>>> + if (sparse_usage_init(nid, map_count)) > >>>> + panic("The node[%d] usemap allocation failed\n", nid); > >>> > >>> Please consider using memblock_alloc_or_panic() in sparse_usage_init(), it > >>> would simplify the code even more. > >> > >> Hi Mike, > >> > >> Should we add a new function like memblock_alloc_node_or_panic? Because > >> we want to allocate vmemmap pages on the same node. > > > > Heh, I missed the nid part :) > > There are a few _node_ or _nid_ allocation helpers in memblock, starting to > > add _nopanic for them would be overkill. Let's keep panic()s at call sites. > > We can add a panic inside memmap_alloc() because it is used specifically for > memmap allocation. To some extent, this also reduces the number of places where > callers need to add a panic. What do you think? Right, with sparse_buffer_alloc() and with this change memmap_alloc() can panic(). I like the idea. > Thanks. -- Sincerely yours, Mike.