Skip to content

Commit

Permalink
hugetlb, rmap: add BUG_ON(!PageLocked) in hugetlb_add_anon_rmap()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Naoya Horiguchi authored and Linus Torvalds committed Sep 24, 2010
1 parent 56c9cfb commit a850ea3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a850ea3

Please sign in to comment.