Skip to content

Commit

Permalink
thp: run vma_adjust_trans_huge() outside i_mmap_rwsem
Browse files Browse the repository at this point in the history
vma_addjust_trans_huge() splits pmd if it's crossing VMA boundary.
During split we munlock the huge page which requires rmap walk.  rmap
wants to take the lock on its own.

Let's move vma_adjust_trans_huge() outside i_mmap_rwsem to fix this.

Link: http://lkml.kernel.org/r/1466021202-61880-19-git-send-email-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
kiryl authored and torvalds committed Jul 26, 2016
1 parent b237ade commit 37f9f55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ again: remove_next = 1 + (end > next->vm_end);
}
}

vma_adjust_trans_huge(vma, start, end, adjust_next);

if (file) {
mapping = file->f_mapping;
root = &mapping->i_mmap;
Expand All @@ -695,8 +697,6 @@ again: remove_next = 1 + (end > next->vm_end);
}
}

vma_adjust_trans_huge(vma, start, end, adjust_next);

anon_vma = vma->anon_vma;
if (!anon_vma && adjust_next)
anon_vma = next->anon_vma;
Expand Down

0 comments on commit 37f9f55

Please sign in to comment.