Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.com
Signed-off-by: David 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: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
c31783ee 93fb70aa

+2 -7
+2
include/linux/pagewalk.h
··· 27 27 * "do page table walk over the current vma", returning 28 28 * a negative value means "abort current page table walk 29 29 * right now" and returning 1 means "skip the current vma" 30 + * Note that this callback is not called when the caller 31 + * passes in a single VMA as for walk_page_vma(). 30 32 * @pre_vma: if set, called before starting walk on a non-null vma. 31 33 * @post_vma: if set, called after a walk on a non-null vma, provided 32 34 * that @pre_vma and the vma walk succeeded.
-7
mm/pagewalk.c
··· 526 526 .vma = vma, 527 527 .private = private, 528 528 }; 529 - int err; 530 529 531 530 if (!walk.mm) 532 531 return -EINVAL; 533 532 534 533 mmap_assert_locked(walk.mm); 535 - 536 - err = walk_page_test(vma->vm_start, vma->vm_end, &walk); 537 - if (err > 0) 538 - return 0; 539 - if (err < 0) 540 - return err; 541 534 return __walk_page_range(vma->vm_start, vma->vm_end, &walk); 542 535 } 543 536