===================================================================
@@ -2632,9 +2632,18 @@ void __meminit memmap_init_zone(unsigned
* exist on hotplugged memory.
*/
if (context == MEMMAP_EARLY) {
+ int nid_from_node_memory_map;
+
if (!early_pfn_valid(pfn))
continue;
- if (!early_pfn_in_nid(pfn, nid))
+ /*
+ * early_pfn_to_nid() returns -1 if the page doesn't
+ * exist in early_node_map[]. Initialize it in force
+ * and set PG_reserved at el.
+ */
+ nid_from_node_memory_map = early_pfn_to_nid(pfn);
+ if (nid_from_node_memory_map > -1 &&
+ nid_from_node_memory_map != nid)
continue;
}
page = pfn_to_page(pfn);
@@ -3001,7 +3010,7 @@ int __meminit early_pfn_to_nid(unsigned
return early_node_map[i].nid;
}
- return 0;
+ return -1;
}
#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
===================================================================
@@ -1070,12 +1070,6 @@ void sparse_init(void);
#define sparse_index_init(_sec, _nid) do {} while (0)
#endif /* CONFIG_SPARSEMEM */
-#ifdef CONFIG_NODES_SPAN_OTHER_NODES
-#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
-#else
-#define early_pfn_in_nid(pfn, nid) (1)
-#endif
-
#ifndef early_pfn_valid
#define early_pfn_valid(pfn) (1)
#endif