]> git.baikalelectronics.ru Git - kernel.git/commit
mem-hotplug: don't clear the only node in new_node_page()
authorLi Zhong <zhong@linux.vnet.ibm.com>
Mon, 19 Sep 2016 21:43:52 +0000 (14:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 19 Sep 2016 22:36:16 +0000 (15:36 -0700)
commita2e18659cc42caa90213e6f78183e0448b4eceb9
tree3d5ba54acea02ab5c1d44161cf239b6273d451f6
parentd72eab3189b114365644748c0ec93eb24f1c1f20
mem-hotplug: don't clear the only node in new_node_page()

Commit 2a6cb39061a3 ("mem-hotplug: alloc new page from a nearest
neighbor node when mem-offline") introduced new_node_page() for memory
hotplug.

In new_node_page(), the nid is cleared before calling
__alloc_pages_nodemask().  But if it is the only node of the system, and
the first round allocation fails, it will not be able to get memory from
an empty nodemask, and will trigger oom.

The patch checks whether it is the last node on the system, and if it
is, then don't clear the nid in the nodemask.

Fixes: 2a6cb39061a3 ("mem-hotplug: alloc new page from a nearest neighbor node when mem-offline")
Link: http://lkml.kernel.org/r/1473044391.4250.19.camel@TP420
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Reported-by: John Allen <jallen@linux.vnet.ibm.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory_hotplug.c