Commit b4bc7817 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jason Gunthorpe

pagewalk: use lockdep_assert_held for locking validation

Use lockdep to check for held locks instead of using home grown asserts.

Link: https://lore.kernel.org/r/20190828141955.22210-4-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 7b86ac33
...@@ -317,7 +317,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start, ...@@ -317,7 +317,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start,
if (!walk.mm) if (!walk.mm)
return -EINVAL; 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); vma = find_vma(walk.mm, start);
do { do {
...@@ -367,7 +367,7 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, ...@@ -367,7 +367,7 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
if (!walk.mm) if (!walk.mm)
return -EINVAL; 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); err = walk_page_test(vma->vm_start, vma->vm_end, &walk);
if (err > 0) if (err > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment