mm: fix the incorrect hugepages count
Subsystems (2)
PATCH 1/1 mm: fix the incorrect hugepages count
From: zhong jiang <[email protected]>
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.
--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)
mm/hugetlb.c +1 -0
@@ -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);
Signature · 1 line
1.8.3.1
Quoted 18 lines · zhongjiang
From: zhong jiang <[email protected]>
when memory hotplug enable, free hugepages will be freed if movable node offline. therefore,
/proc/sys/vm/nr_hugepageswill be incorrect.The patch fix it by reduce the
max_huge_pageswhen the node offline.Signed-off-by zhong jiang <[email protected]>--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)mm/hugetlb.c +0
-0
mm/hugetlb.c static void dissolve_free_huge_page(struct page *page) · line 1454
Quoted 7 lines
mm/hugetlb.c +1
-0@@ -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);
Adding Naoya as he was the original author of this code.
Quoted 1 line
From quick look it appears that the huge page will be migrated (allocated
on another node). If my understanding is correct, then max_huge_pages should not be adjusted here.
Signature · 7 lines
Mike Kravetz -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 28 lines · Mike Kravetz
Quoted 18 lines · zhongjiang
From: zhong jiang <[email protected]>
when memory hotplug enable, free hugepages will be freed if movable node offline. therefore,
/proc/sys/vm/nr_hugepageswill be incorrect.The patch fix it by reduce the
max_huge_pageswhen the node offline.Signed-off-by zhong jiang <[email protected]>--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)mm/hugetlb.c +0
-0mm/hugetlb.c static void dissolve_free_huge_page(struct page *page) · line 1454
Quoted 7 lines
mm/hugetlb.c +1
-0@@ -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);Adding Naoya as he was the original author of this code.
Quoted 4 lines
Quoted 1 line
From quick look it appears that the huge page will be migrated (allocated
on another node). If my understanding is correct, then
max_huge_pagesshould not be adjusted here.
we need to take free hugetlb pages into account. of course, the allocated huge pages is no need to reduce. The patch just reduce the free hugetlb pages count.
Thanks
zhongjiang
Naoya Horiguchi
Acked-byQuoted 6 lines · zhong jiang
Quoted 5 lines · Mike Kravetz
Quoted 4 lines · zhongjiang
From: zhong jiang <[email protected]>
when memory hotplug enable, free hugepages will be freed if movable node offline. therefore,
/proc/sys/vm/nr_hugepageswill be incorrect.
This sounds a bit odd to me because /proc/sys/vm/nr_hugepages returns h->nr_huge_pages or h->nr_huge_pages_node[nid], which is already considered in dissolve_free_huge_page (via update_and_free_page).
I think that h->max_huge_pages effectively means the pool size, and h->nr_huge_pages means total hugepage number (which can be greater than the pool size when there's overcommiting/surplus.)
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.
Quoted 23 lines
Quoted 23 lines
Quoted 14 lines
The patch fix it by reduce the
max_huge_pageswhen the node offline.Signed-off-by zhong jiang <[email protected]>--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)mm/hugetlb.c +0
-0mm/hugetlb.c static void dissolve_free_huge_page(struct page *page) · line 1454
Quoted 7 lines
mm/hugetlb.c +1
-0@@ -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);Adding Naoya as he was the original author of this code.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
From quick look it appears that the huge page will be migrated (allocated
on another node). If my understanding is correct, then
max_huge_pagesshould not be adjusted here.we need to take free hugetlb pages into account. of course, the allocated huge pages is no need to reduce. The patch just reduce the free hugetlb pages count.
I
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>