hugetlb, rmap: add BUG_ON(!PageLocked) in hugetlb_add_anon_rmap()
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Fri, 10 Sep 2010 04:23:06 +0000 (13:23 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Sep 2010 00:29:19 +0000 (17:29 -0700)
Confirming page lock is held in hugetlb_add_anon_rmap() may be useful
to detect possible future problems.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/rmap.c

index 2854857fd63b6894c3d50670daa9e12f27b13092..9d2ba01bd4f91d3db707524cc9bafd5e81f623b4 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1582,6 +1582,8 @@ void hugepage_add_anon_rmap(struct page *page,
 {
        struct anon_vma *anon_vma = vma->anon_vma;
        int first;
+
+       BUG_ON(!PageLocked(page));
        BUG_ON(!anon_vma);
        BUG_ON(address < vma->vm_start || address >= vma->vm_end);
        first = atomic_inc_and_test(&page->_mapcount);