[PATCH] mm: fix the incorrect hugepages count

From: zhongjiang
Date: Sun Aug 07 2016 - 23:02:06 EST


From: zhong jiang <zhongjiang@xxxxxxxxxx>

when memory hotplug enable, free hugepages will be freed if movable node offline.
therefore, /proc/sys/vm/nr_hugepages will be incorrect.

The patch fix it by reduce the max_huge_pages when the node offline.

Signed-off-by: zhong jiang <zhongjiang@xxxxxxxxxx>
---
mm/hugetlb.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f904246..3356e3a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1448,6 +1448,7 @@ static void dissolve_free_huge_page(struct page *page)
list_del(&page->lru);
h->free_huge_pages--;
h->free_huge_pages_node[nid]--;
+ h->max_huge_pages--;
update_and_free_page(h, page);
}
spin_unlock(&hugetlb_lock);
--
1.8.3.1