]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
thp: run vma_adjust_trans_huge() outside i_mmap_rwsem
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 26 Jul 2016 22:25:48 +0000 (15:25 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 27 Oct 2017 02:31:46 +0000 (22:31 -0400)
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>
Conflicts:
mm/mmap.c

Orabug: 27026170

(cherry picked from commit 37f9f5595c26d3cb644ca2fab83dc4c4db119f9f)
Signed-off-by: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Reviewed-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
mm/mmap.c

index 4c07adafa01b101127f3d1c07206419eec90e6b6..839d816bd5c3f6a1ce5310408554663d08faaa65 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -805,6 +805,9 @@ int vma_adjust(struct vm_area_struct *vma, unsigned long start,
                }
        }
 
+again:
+       vma_adjust_trans_huge(vma, start, end, adjust_next);
+
        if (file) {
                mapping = file->f_mapping;
                root = &mapping->i_mmap;
@@ -824,8 +827,6 @@ int vma_adjust(struct vm_area_struct *vma, unsigned long start,
                        __vma_link_file(insert);
                }
        }
-again:
-       vma_adjust_trans_huge(vma, start, end, adjust_next);
 
        anon_vma = vma->anon_vma;
        if (!anon_vma && adjust_next)