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 4C06730B525 for ; Tue, 28 Apr 2026 07:32:46 +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=1777361566; cv=none; b=NHMDaBmqvUJorDsdTMS+raMzmN6mO/Beii3z8TAPiATuILrRJg+dDRPtPHUIgk8k/tytQsNwQPIaPjpFCtDkhGFgX3o5ptZzzuEzqYgyjRhfs+Vh0t8gCiQQPWURVGR2YHh9FtQlevcYbNu+eQzbTFFZIAkePzX0HQHjRvUageU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777361566; c=relaxed/simple; bh=bivJkrDnkum5vfxFBGBfafZmKUqFTGG/gO14qECezIs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jhbbd4kWOkcrDq8HEWmtykhxYU0W0zGU99SVVwf6dpjDnc1JjVJEfrnaHzmRCtN9uERTEMe8g9tLaPu1S4E7lDKeI73v6dv5Ew88exetcvW59dEv8z92qoWGqY7OU9k9xbsTtwkl5I/obRpTO07alwBD8qc2M8pID1qx1DSwRqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KS7VVKWJ; 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="KS7VVKWJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE54C2BCB8; Tue, 28 Apr 2026 07:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777361565; bh=bivJkrDnkum5vfxFBGBfafZmKUqFTGG/gO14qECezIs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KS7VVKWJYg+OP508UYe/zMGahM3pGjCvFKJNFgui6nFLKxhqcyUTWKExOOt/iPanR 1kpLWf3iizL3uPEkGZDnNELXdYcSQmR2QOME22VyoIok8i+xmr0YrQ82VEzaqP4hSd kRkad5IRChKSJvPXOs9HjfC+HvNs2zfMj2hjHJXF8XzM/c51ES4I1dWBRptVLPgF9+ J3JdUsgduxLtmu8U4FMz4gPuVsoijnN0Uc2lZZHHNSLm4EJlzt1Juucu6EAMcKT16O 5IqdNjee3CXQ3PJCrp1Am+EErSqQV9mjC24edo3savF+AJDqw3zjJGobF99o8doFuv ZWBbcOfL84Xiw== Date: Tue, 28 Apr 2026 09:32:36 +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> <96DB49C7-A7C2-4F53-8321-FF4A4ECDFF95@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96DB49C7-A7C2-4F53-8321-FF4A4ECDFF95@linux.dev> Hi Muchun, On Tue, Apr 28, 2026 at 03:02:14PM +0800, Muchun Song wrote: > > >> diff --git a/mm/sparse.c b/mm/sparse.c > >> index effdac6b0ab1..5c12b979a618 100644 > >> --- a/mm/sparse.c > >> +++ b/mm/sparse.c > >> @@ -354,19 +354,15 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin, > >> unsigned long map_count) > >> { > >> unsigned long pnum; > >> - struct page *map; > >> - struct mem_section *ms; > >> - > >> - if (sparse_usage_init(nid, map_count)) { > >> - pr_err("%s: node[%d] usemap allocation failed", __func__, nid); > >> - goto failed; > >> - } > >> > >> + 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, > > Yes. I have several more updates for v2. Please hold off on reviewing > the current version to avoid wasting your time; I’ll send the new one > over shortly. Thanks for the heads up! I'll stop for now :) > Thanks. -- Sincerely yours, Mike.