Skip to contentSkip to conversation

mm: hugetlb alloc_fresh_huge_page bogus node loop fix

PATCH In review Paul Jackson 2 participants 2 messages Mar 19, 2006 – Mar 20, 2006

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

PATCH 1/1 mm: hugetlb alloc_fresh_huge_page bogus node loop fix

From: Paul Jackson <[email protected]>

Fix bogus node loop in hugetlb.c alloc_fresh_huge_page(), which was assuming that nodes are numbered contiguously from 0 to num_online_nodes(). Once the hotplug folks get this far, that will be false.

---

 mm/hugetlb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
mm/hugetlb.c +3 -1
@@ -105,7 +105,9 @@ static int alloc_fresh_huge_page(void)
 	struct page *page;
 	page = alloc_pages_node(nid, GFP_HIGHUSER|__GFP_COMP|__GFP_NOWARN,
 					HUGETLB_PAGE_ORDER);
-	nid = (nid + 1) % num_online_nodes();
+	nid = next_node(nid, node_online_map);
+	if (nid == MAX_NUMNODES)
+		nid = first_node(node_online_map);
 	if (page) {
 		page[1].lru.next = (void *)free_huge_page;	/* dtor */
 		spin_lock(&hugetlb_lock);
Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373