mm: meminit: initialise a subset of struct pages if CONFIG_DEFERRED_STRUCT_PAGE_INIT...
[cascardo/linux.git] / drivers / base / node.c
index a2aa65b..31df474 100644 (file)
@@ -359,12 +359,16 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
 #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
 #define page_initialized(page)  (page->lru.next)
 
-static int get_nid_for_pfn(unsigned long pfn)
+static int __init_refok get_nid_for_pfn(unsigned long pfn)
 {
        struct page *page;
 
        if (!pfn_valid_within(pfn))
                return -1;
+#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
+       if (system_state == SYSTEM_BOOTING)
+               return early_pfn_to_nid(pfn);
+#endif
        page = pfn_to_page(pfn);
        if (!page_initialized(page))
                return -1;