memory-hotplug: do not allocate pgdat if it was not freed when offline.
memory-hotplug: do not allocate pgdat if it was not freed when offline.

Since there is no way to guarentee the address of pgdat/zone is not on
stack of any kernel threads or used by other kernel objects without
reference counting or other symchronizing method, we cannot reset
node_data and free pgdat when offlining a node.  Just reset pgdat to 0
and reuse the memory when the node is online again.

The problem is suggested by Kamezawa Hiroyuki.  The idea is from Wen
Congyang.

NOTE: If we don't reset pgdat to 0, the WARN_ON in free_area_init_node()
      will be triggered.

[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: fix warning when CONFIG_NEED_MULTIPLE_NODES=n]
[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: fix the warning again again]
Signed-off-by: Tang Chen <4f61c4810b5ff5aa3e373c07e6d9ef9c55e4952f@cn.fujitsu.com>
Reviewed-by: Wen Congyang <59c7438a9275f5dd0b96a91958b493a9d005ad46@cn.fujitsu.com>
Cc: KOSAKI Motohiro <70a1d3ef3e17a2bb0f09a1b2e6c86f607ed1d6d9@jp.fujitsu.com>
Cc: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@huawei.com>
Cc: Jianguo Wu <bfa600f2f37bdb58cd7013a13133683dd75e8c4c@huawei.com>
Cc: Kamezawa Hiroyuki <634f508bd7c47cf0ee4126243675c3e598920fbc@jp.fujitsu.com>
Cc: Lai Jiangshan <4c9eb49378914b743bdd32292c04df29b820d73e@cn.fujitsu.com>
Cc: Wu Jianguo <bfa600f2f37bdb58cd7013a13133683dd75e8c4c@huawei.com>
Cc: Yasuaki Ishimatsu <9b26f769475fafc2d25107053b1bdd774d49438a@jp.fujitsu.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: "H. Peter Anvin" <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas