hugetlb, rmap: add BUG_ON(!PageLocked) in hugetlb_add_anon_rmap()

Confirming page lock is held in hugetlb_add_anon_rmap() may be useful
to detect possible future problems.

Signed-off-by: Naoya Horiguchi <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Acked-by: Andrea Arcangeli <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Naoya Horiguchi 2010-09-10 13:23:06 +09:00 • committed by Linus Torvalds
commit a850ea3037

View file

@ -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);