Skip to content

Commit

Permalink
mm: thp: avoid false positive VM_BUG_ON_PAGE in page_move_anon_rmap()
Browse files Browse the repository at this point in the history
If page_move_anon_rmap() is refiling a pmd-splitted THP mapped in a tail
page from a pte, the "address" must be THP aligned in order for the
page->index bugcheck to pass in the CONFIG_DEBUG_VM=y builds.

Link: http://lkml.kernel.org/r/1464253620-106404-1-git-send-email-kirill.shutemov@linux.intel.com
Fixes: 6d0a07e ("mm: thp: calculate the mapcount correctly for THP pages during WP faults")
Signed-off-by: Kirill A. Shutemov <[email protected]>
Reported-by: Mika Westerberg <[email protected]>
Tested-by: Mika Westerberg <[email protected]>
Reviewed-by: Andrea Arcangeli <[email protected]>
Cc: <[email protected]>        [4.5]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed May 27, 2016
1 parent e2fe145 commit 0798d3c
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 @@ -1098,6 +1098,8 @@ void page_move_anon_rmap(struct page *page,

VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_VMA(!anon_vma, vma);
if (IS_ENABLED(CONFIG_DEBUG_VM) && PageTransHuge(page))
address &= HPAGE_PMD_MASK;
VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address), page);

anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
Expand Down

0 comments on commit 0798d3c

Please sign in to comment.