History

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.

Thomas Hellstrom committed 7 years ago

Commit ea81bae1 parent 7aef29f1 file · +0 −2Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/huge_mm.h+0−2
@@ -216,7 +216,6 @@ static inline int is_swap_pmd(pmd_t pmd) · 215 unmodified lines
216static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,216static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
217 struct vm_area_struct *vma)217 struct vm_area_struct *vma)
218{218{
219 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
220 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd))219 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd))
221 return __pmd_trans_huge_lock(pmd, vma);220 return __pmd_trans_huge_lock(pmd, vma);
222 else221 else
@@ -225,7 +224,6 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, · 2 unmodified lines
225static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,224static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
226 struct vm_area_struct *vma)225 struct vm_area_struct *vma)
227{226{
228 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
229 if (pud_trans_huge(*pud) || pud_devmap(*pud))227 if (pud_trans_huge(*pud) || pud_devmap(*pud))
230 return __pud_trans_huge_lock(pud, vma);228 return __pud_trans_huge_lock(pud, vma);
231 else229 else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t