[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yz3sIY5Njzda3XSA@x1n>
Date: Wed, 5 Oct 2022 16:42:09 -0400
From: Peter Xu <peterx@...hat.com>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Shuah Khan <shuah@...nel.org>, Hugh Dickins <hughd@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Andrea Arcangeli <aarcange@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jason Gunthorpe <jgg@...dia.com>,
John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH v1 5/7] mm/pagewalk: add walk_page_range_vma()
On Fri, Sep 30, 2022 at 04:19:29PM +0200, David Hildenbrand wrote:
> +int walk_page_range_vma(struct vm_area_struct *vma, unsigned long start,
> + unsigned long end, const struct mm_walk_ops *ops,
> + void *private)
> +{
> + struct mm_walk walk = {
> + .ops = ops,
> + .mm = vma->vm_mm,
> + .vma = vma,
> + .private = private,
> + };
> + int err;
> +
> + if (start >= end || !walk.mm)
> + return -EINVAL;
> + if (start < vma->vm_start || end > vma->vm_end)
> + return -EINVAL;
> +
> + mmap_assert_locked(walk.mm);
> +
> + err = walk_page_test(start, end, &walk);
According to test_walk():
* @test_walk: caller specific callback function to determine whether
* we walk over the current vma or not. Returning 0 means
* "do page table walk over the current vma", returning
* a negative value means "abort current page table walk
* right now" and returning 1 means "skip the current vma"
Since this helper has vma passed in, not sure whether this is needed at
all?
walk_page_vma_range() sounds slightly better to me as it does look more
like an extension of walk_page_vma(), rather than sister version of
walk_page_range_novma() (which works for "no backing VMA" case). But no
strong opinion.
--
Peter Xu
Powered by blists - more mailing lists