Skip to contentSkip to conversation

hugetlb: use free_pool_huge_page() to return unused surplus pages fix

PATCH New Lee Schermerhorn 1 participant 1 message Jun 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hugetlb: use free_pool_huge_page() to return unused surplus pages fix

PATCH hugetlb: use free_pool_huge_page() to return unused surplus pages fix

Against: 25jun mmotm.

Fixes bug detected by libhugetlbfs test suite in:
hugetlb-use-free_pool_huge_page-to-return-unused-surplus-pages.patch

Can't just "continue" for node with no surplus pages when returning unused surplus. We need to advance to 'next node to free'.

With this fix, the "hugetlb balance free across nodes" series passes the test suite.

 mm/hugetlb.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
mm/hugetlb.c +4 -6
Index: linux-2.6.31-rc1-mmotm-090625-1549/mm/hugetlb.c
===================================================================
@@ -697,13 +697,11 @@ static int free_pool_huge_page(struct hs
 
 	do {
 		/*
-		 * If we're returning unused surplus pages, skip nodes
-		 * with no surplus.
+		 * If we're returning unused surplus pages, only examine
+		 * nodes with surplus pages.
 		 */
-		if (acct_surplus && !h->surplus_huge_pages_node[next_nid])
-			continue;
-
-		if (!list_empty(&h->hugepage_freelists[next_nid])) {
+		if ((!acct_surplus || h->surplus_huge_pages_node[next_nid]) &&
+		    !list_empty(&h->hugepage_freelists[next_nid])) {
 			struct page *page =
 				list_entry(h->hugepage_freelists[next_nid].next,
 					  struct page, lru);

--
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>