]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
pagewalk: use lockdep_assert_held for locking validation
authorChristoph Hellwig <hch@lst.de>
Wed, 28 Aug 2019 14:19:55 +0000 (16:19 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Sat, 7 Sep 2019 07:28:04 +0000 (04:28 -0300)
Use lockdep to check for held locks instead of using home grown asserts.

Link: https://lore.kernel.org/r/20190828141955.22210-4-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
mm/pagewalk.c

index b8762b673a3d4cd9c5813502351a0635fdf126be..d48c2a986ea3f8dfffaed7c2c99ca980375f4726 100644 (file)
@@ -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 {
@@ -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)