mm: use early_pfn_to_nid in register_page_bootmem_info_node
authorYang Shi <yang.shi@linaro.org>
Fri, 27 May 2016 21:27:32 +0000 (14:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2016 21:49:37 +0000 (14:49 -0700)
register_page_bootmem_info_node() is invoked in mem_init(), so it will
be called before page_alloc_init_late() if DEFERRED_STRUCT_PAGE_INIT is
enabled.  But, pfn_to_nid() depends on memmap which won't be fully setup
until page_alloc_init_late() is done, so replace pfn_to_nid() by
early_pfn_to_nid().

Link: http://lkml.kernel.org/r/1464210007-30930-1-git-send-email-yang.shi@linaro.org
Signed-off-by: Yang Shi <yang.shi@linaro.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory_hotplug.c

index caf2a14..b8ee080 100644 (file)
@@ -300,7 +300,7 @@ void register_page_bootmem_info_node(struct pglist_data *pgdat)
                 * multiple nodes we check that this pfn does not already
                 * reside in some other nodes.
                 */
-               if (pfn_valid(pfn) && (pfn_to_nid(pfn) == node))
+               if (pfn_valid(pfn) && (early_pfn_to_nid(pfn) == node))
                        register_page_bootmem_info_section(pfn);
        }
 }