linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: page_alloc: call panic() when memoryless node allocation fails
@ 2023-02-12 11:10 Qi Zheng
  2023-02-13 18:53 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Qi Zheng @ 2023-02-12 11:10 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Qi Zheng

In free_area_init(), we will continue to run after pgdat of memoryless
node allocation 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.

Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
 mm/page_alloc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0745aedebb37..588555754601 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8360,11 +8360,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);
 
-- 
2.20.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-14  3:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12 11:10 [PATCH] mm: page_alloc: call panic() when memoryless node allocation fails Qi Zheng
2023-02-13 18:53 ` Andrew Morton
2023-02-14  3:14   ` Qi Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox