Skip to content

Commit

Permalink
pagewalk: use lockdep_assert_held for locking validation
Browse files Browse the repository at this point in the history
Use lockdep to check for held locks instead of using home grown asserts.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Steven Price <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and jgunthorpe committed Sep 7, 2019
1 parent 7b86ac3 commit b4bc781
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/pagewalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start,
if (!walk.mm)
return -EINVAL;

VM_BUG_ON_MM(!rwsem_is_locked(&walk.mm->mmap_sem), walk.mm);
lockdep_assert_held(&walk.mm->mmap_sem);

vma = find_vma(walk.mm, start);
do {
Expand Down Expand Up @@ -367,7 +367,7 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
if (!walk.mm)
return -EINVAL;

VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem));
lockdep_assert_held(&walk.mm->mmap_sem);

err = walk_page_test(vma->vm_start, vma->vm_end, &walk);
if (err > 0)
Expand Down

0 comments on commit b4bc781

Please sign in to comment.