Skip to contentSkip to conversation

fix extra page ref count in follow_hugetlb_page

PATCH New Chen, Kenneth W 1 participant 1 message Mar 30, 2006

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

PATCH 1/1 fix extra page ref count in follow_hugetlb_page

"[PATCH] optimize follow_hugetlb_page" breaks mlock on hugepage areas.

I mis-interpret pages argument and made get_page() unconditional. It should only get a ref count when "pages" argument is non-null.

Credit goes to Adam Litke who spotted the bug.

mm/hugetlb.c renamed from mm/hugetlb.c.orig +3 -2
@@ -555,9 +555,10 @@ int follow_hugetlb_page(struct mm_struct
 		pfn_offset = (vaddr & ~HPAGE_MASK) >> PAGE_SHIFT;
 		page = pte_page(*pte);
 same_page:
-		get_page(page);
-		if (pages)
+		if (pages) {
+			get_page(page);
 			pages[i] = page + pfn_offset;
+		}
 
 		if (vmas)
 			vmas[i] = vma;

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