Commit c31783ee authored by David Hildenbrand's avatar David Hildenbrand Committed by Andrew Morton

mm/pagewalk: don't trigger test_walk() in walk_page_vma()

As Peter points out, the caller passes a single VMA and can just do that
check itself.

And in fact, no existing users rely on test_walk() getting called.  So
let's just remove it and make the implementation slightly more efficient.

Link: https://lkml.kernel.org/r/20221021101141.84170-7-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 93fb70aa
...@@ -27,6 +27,8 @@ struct mm_walk; ...@@ -27,6 +27,8 @@ struct mm_walk;
* "do page table walk over the current vma", returning * "do page table walk over the current vma", returning
* a negative value means "abort current page table walk * a negative value means "abort current page table walk
* right now" and returning 1 means "skip the current vma" * right now" and returning 1 means "skip the current vma"
* Note that this callback is not called when the caller
* passes in a single VMA as for walk_page_vma().
* @pre_vma: if set, called before starting walk on a non-null vma. * @pre_vma: if set, called before starting walk on a non-null vma.
* @post_vma: if set, called after a walk on a non-null vma, provided * @post_vma: if set, called after a walk on a non-null vma, provided
* that @pre_vma and the vma walk succeeded. * that @pre_vma and the vma walk succeeded.
......
...@@ -526,18 +526,11 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, ...@@ -526,18 +526,11 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
.vma = vma, .vma = vma,
.private = private, .private = private,
}; };
int err;
if (!walk.mm) if (!walk.mm)
return -EINVAL; return -EINVAL;
mmap_assert_locked(walk.mm); mmap_assert_locked(walk.mm);
err = walk_page_test(vma->vm_start, vma->vm_end, &walk);
if (err > 0)
return 0;
if (err < 0)
return err;
return __walk_page_range(vma->vm_start, vma->vm_end, &walk); return __walk_page_range(vma->vm_start, vma->vm_end, &walk);
} }
......
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