Re: [PATCH v3] mm: fix panic in __alloc_pages

From: Michal Hocko
Date: Tue Dec 07 2021 - 05:54:38 EST


Hi,
I didn't have much time to dive into this deeper and I have hit some
problems handling this in an arch specific code so I have tried to play
with this instead:

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c5952749ad40..4d71759d0d9b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8032,8 +8032,16 @@ void __init free_area_init(unsigned long *max_zone_pfn)
/* Initialise every node */
mminit_verify_pageflags_layout();
setup_nr_node_ids();
- for_each_online_node(nid) {
+ for_each_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid);
+
+ if (!node_online(nid)) {
+ pr_warn("Node %d uninitialized by the platform. Please report with memory map.\n");
+ alloc_node_data(nid);
+ free_area_init_memoryless_node(nid);
+ continue;
+ }
+
free_area_init_node(nid);

/* Any memory on that node */

Could you give it a try? I do not have any machine which would exhibit
the problem so I cannot really test this out. I hope build_zone_info
will not choke on this. I assume the node distance table is
uninitialized for these nodes and IIUC this should lead to an assumption
that all other nodes are close. But who knows that can blow up there.

Btw. does this make any sense at all to others?
--
Michal Hocko
SUSE Labs