memory-hotplug: fix wrong edge when hot add a new node
authorXishi Qiu <qiuxishi@huawei.com>
Fri, 14 Aug 2015 22:35:16 +0000 (15:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Aug 2015 22:56:32 +0000 (15:56 -0700)
commitf9126ab9241f66562debf69c2c9d8fee32ddcc53
tree99b24da6550082e628b756aab3275190f6fdcae3
parent2baf9e8948530f2c6af36f0e3d9a26e0315900e6
memory-hotplug: fix wrong edge when hot add a new node

When we add a new node, the edge of memory may be wrong.

e.g. system has 4 nodes, and node3 is movable, node3 mem:[24G-32G],

1. hotremove the node3,
2. then hotadd node3 with a part of memory, mem:[26G-30G],
3. call hotadd_new_pgdat()
        free_area_init_node()
                get_pfn_range_for_nid()
4. it will return wrong start_pfn and end_pfn, because we have not
update the memblock.

This patch also fixes a BUG_ON during hot-addition, please see
http://marc.info/?l=linux-kernel&m=142961156129456&w=2

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory_hotplug.c
mm/page_alloc.c