mm/hugetlb: fix incorrect hugepages count during mem hotplug
authorzhong jiang <zhongjiang@huawei.com>
Thu, 11 Aug 2016 22:32:55 +0000 (15:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Aug 2016 23:58:13 +0000 (16:58 -0700)
commitc1470b33bb6e18cddd361fef339ef225b8339fe7
tree9689ae48f5c43edd37a8f472980817eb23485c17
parent85e97be32c6242c98dbbc7a241b4a78c1b93327b
mm/hugetlb: fix incorrect hugepages count during mem hotplug

When memory hotplug operates, free hugepages will be freed if the
movable node is offline.  Therefore, /proc/sys/vm/nr_hugepages will be
incorrect.

Fix it by reducing max_huge_pages when the node is offlined.

n-horiguchi@ah.jp.nec.com said:

: dissolve_free_huge_page intends to break a hugepage into buddy, and the
: destination hugepage is supposed to be allocated from the pool of the
: destination node, so the system-wide pool size is reduced.  So adding
: h->max_huge_pages-- makes sense to me.

Link: http://lkml.kernel.org/r/1470624546-902-1-git-send-email-zhongjiang@huawei.com
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c