[PATCH] Fix copying of pgdat array on each node for ia64 memory hotplug
[deliverable/linux.git] / arch / ia64 / mm / discontig.c
index 525b082eb6619821fed5224fccadabaf79002cf4..99bd9e30db9694979522b86c0b768cbf7cc6839a 100644 (file)
@@ -313,9 +313,19 @@ static void __meminit scatter_node_data(void)
        pg_data_t **dst;
        int node;
 
-       for_each_online_node(node) {
-               dst = LOCAL_DATA_ADDR(pgdat_list[node])->pg_data_ptrs;
-               memcpy(dst, pgdat_list, sizeof(pgdat_list));
+       /*
+        * for_each_online_node() can't be used at here.
+        * node_online_map is not set for hot-added nodes at this time,
+        * because we are halfway through initialization of the new node's
+        * structures.  If for_each_online_node() is used, a new node's
+        * pg_data_ptrs will be not initialized. Insted of using it,
+        * pgdat_list[] is checked.
+        */
+       for_each_node(node) {
+               if (pgdat_list[node]) {
+                       dst = LOCAL_DATA_ADDR(pgdat_list[node])->pg_data_ptrs;
+                       memcpy(dst, pgdat_list, sizeof(pgdat_list));
+               }
        }
 }
 
This page took 0.039182 seconds and 5 git commands to generate.