Re: [PATCH 09/49] mm: panic on memory allocation failure in sparse_init_nid()

Muchun Song
2026-04-28T07:57:55Z

> On Apr 28, 2026, at 15:32, Mike Rapoport <rppt@kernel.org> wrote:
>
> 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 for the quick response!

To clarify, the first few patches didn't change much, so your feedback
on those is still very relevant and much appreciated. The major updates
are in the later parts of the series, so I'm glad I caught you before
you spent time on those.

I’ll get the new version shortly.

Thanks again!

>
>> Thanks.
>
> --
> Sincerely yours,
> Mike.