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

Mike Rapoport
2026-04-28T07:32:53Z

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.