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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 07-12-21 13:28:31, David Hildenbrand wrote:
[...]
> But maybe I am missing something important regarding online vs. offline
> nodes that your patch changes?

I am relying on alloc_node_data setting the node online. But if we are
to change the call to arch_alloc_node_data then the patch needs to be
more involved. Here is what I have right now. If this happens to be the
right way then there is some additional work to sync up with the hotplug
code.

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c5952749ad40..a296e934ad2f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8032,8 +8032,23 @@ 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) {
-		pg_data_t *pgdat = NODE_DATA(nid);
+	for_each_node(nid) {
+		pg_data_t *pgdat;
+
+		if (!node_online(nid)) {
+			pr_warn("Node %d uninitialized by the platform. Please report with memory map.\n", nid);
+			pgdat = arch_alloc_nodedata(nid);
+			pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat);
+			arch_refresh_nodedata(nid, pgdat);
+			node_set_online(nid);
+			/* TODO do we need register_one_node here or postpone to
+			 * when any memory is onlined there
+			 */
+			free_area_init_memoryless_node(nid);
+			continue;
+		}
+
+		pgdat = NODE_DATA(nid);
 		free_area_init_node(nid);
 
 		/* Any memory on that node */
-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux