From: Thomas Hellstrom Date: Tue, 1 Oct 2019 08:37:33 +0000 (+0200) Subject: mm: Remove BUG_ON mmap_sem not held from xxx_trans_huge_lock() X-Git-Tag: v5.15~5042^2^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea81bae46032022656d45d4a395f1bf3b96697f0;p=platform%2Fkernel%2Flinux-starfive.git mm: Remove BUG_ON mmap_sem not held from xxx_trans_huge_lock() The caller needs to make sure that the vma is not torn down during the lock operation and can also use the i_mmap_rwsem for file-backed vmas. Remove the BUG_ON. We could, as an alternative, add a test that either vma->vm_mm->mmap_sem or vma->vm_file->f_mapping->i_mmap_rwsem are held. Cc: Andrew Morton Cc: Matthew Wilcox Cc: Will Deacon Cc: Peter Zijlstra Cc: Rik van Riel Cc: Minchan Kim Cc: Michal Hocko Cc: Huang Ying Cc: Jérôme Glisse Cc: Kirill A. Shutemov Signed-off-by: Thomas Hellstrom Acked-by: Kirill A. Shutemov --- diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 93d5cf0..0b84e13 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -216,7 +216,6 @@ static inline int is_swap_pmd(pmd_t pmd) static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) { - VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) return __pmd_trans_huge_lock(pmd, vma); else @@ -225,7 +224,6 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma) { - VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); if (pud_trans_huge(*pud) || pud_devmap(*pud)) return __pud_trans_huge_lock(pud, vma); else