aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen, Kenneth W <kenneth.w.chen@intel.com>2006-03-31 05:29:57 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:49 -0500
commitd6692183ac1d8f4a4e4015f9ce9acc2514618e0b (patch)
tree15d930c84cc93df5bc53ed29290abd46c3135272
parent93fac7041f082297b93655a0e49f659cd7520e40 (diff)
[PATCH] fix extra page ref count in follow_hugetlb_page
git-commit: d5d4b0aa4e1430d73050babba999365593bdb9d2 "[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. Signed-off-by: Ken Chen <kenneth.w.chen@intel.com> Acked-by: Adam Litke <agl@us.ibm.com> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/hugetlb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ebad6bbb3501..d87885eb4acc 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -697,9 +697,10 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
697 pfn_offset = (vaddr & ~HPAGE_MASK) >> PAGE_SHIFT; 697 pfn_offset = (vaddr & ~HPAGE_MASK) >> PAGE_SHIFT;
698 page = pte_page(*pte); 698 page = pte_page(*pte);
699same_page: 699same_page:
700 get_page(page); 700 if (pages) {
701 if (pages) 701 get_page(page);
702 pages[i] = page + pfn_offset; 702 pages[i] = page + pfn_offset;
703 }
703 704
704 if (vmas) 705 if (vmas)
705 vmas[i] = vma; 706 vmas[i] = vma;