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

Mike Rapoport rppt at kernel.org
Wed Apr 29 16:53:25 AEST 2026


On Wed, Apr 29, 2026 at 11:14:14AM +0800, Muchun Song wrote:
> > On Apr 28, 2026, at 21:08, Mike Rapoport <rppt at kernel.org> 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.


More information about the Linuxppc-dev mailing list