diff options
author | Qi Zheng <[email protected]> | 2023-02-12 19:10:27 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2023-02-16 20:43:54 -0800 |
commit | 1bc67ca65b31bcb669c4eaca79b3c8d205bb212a (patch) | |
tree | e1b62c4a59b7737ecd64d0b13f56241743f16e4a | |
parent | 9f550d78b40da21b4da515db4c37d8d7b12aa1a6 (diff) |
mm: page_alloc: call panic() when memoryless node allocation fails
In free_area_init(), we will continue to run after allocation of
memoryless node pgdat fails. However, in the subsequent process (such as
when initializing zonelist), the case that NODE_DATA(nid) is NULL is not
handled, which will cause panic. Instead of this, it's better to call
panic() directly when the memory allocation fails during system boot.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Qi Zheng <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r-- | mm/page_alloc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 21d820c42900..4b6bcec41c8f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8405,11 +8405,9 @@ void __init free_area_init(unsigned long *max_zone_pfn) /* Allocator not initialized yet */ pgdat = arch_alloc_nodedata(nid); - if (!pgdat) { - pr_err("Cannot allocate %zuB for node %d.\n", - sizeof(*pgdat), nid); - continue; - } + if (!pgdat) + panic("Cannot allocate %zuB for node %d.\n", + sizeof(*pgdat), nid); arch_refresh_nodedata(nid, pgdat); free_area_init_memoryless_node(nid); |