mm, meminit: allow early_pfn_to_nid to be used during runtime
authorMel Gorman <[email protected]>
Thu, 6 Aug 2015 22:46:13 +0000 (15:46 -0700)
committerLinus Torvalds <[email protected]>
Fri, 7 Aug 2015 01:39:40 +0000 (04:39 +0300)
commit7ace99170789bc53cbb7e9e352d7a3851208fbcf
tree8563a1e739a73bf29bf93154b88ac7ef52209d1c
parentde54b9ac253787c366bbfb28d901a31954eb3511
mm, meminit: allow early_pfn_to_nid to be used during runtime

early_pfn_to_nid() historically was inherently not SMP safe but only
used during boot which is inherently single threaded or during hotplug
which is protected by a giant mutex.

With deferred memory initialisation there was a thread-safe version
introduced and the early_pfn_to_nid would trigger a BUG_ON if used
unsafely.  Memory hotplug hit that check.  This patch makes
early_pfn_to_nid introduces a lock to make it safe to use during
hotplug.

Signed-off-by: Mel Gorman <[email protected]>
Reported-by: Alex Ng <[email protected]>
Tested-by: Alex Ng <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Nicolai Stange <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Fengguang Wu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c