From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Hugh Dickins <hughd@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
Andrea Arcangeli <aarcange@redhat.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jason Gunthorpe <jgg@nvidia.com>,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v1 5/7] mm/pagewalk: add walk_page_range_vma()
Date: Thu, 6 Oct 2022 11:35:38 +0200 [thread overview]
Message-ID: <274c790a-04c7-078a-19be-851066dc21bb@redhat.com> (raw)
In-Reply-To: <Yz3sIY5Njzda3XSA@x1n>
On 05.10.22 22:42, Peter Xu wrote:
> 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?
I kept it because walk_page_vma() similarly has it -- walk_page_vma()
walks the whole VMA range.
I do agree that it's kind of weird to have it like that. All users of
walk_page_vma() don't use it, so we can just get rid of it there as
well. Might make the walk slightly faster.
>
> 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.
>
I matched that to walk_page_range_novma(). Now we have
walk_page_range
walk_page_vma
walk_page_range_novma
walk_page_range_vma
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-10-06 9:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 14:19 [PATCH v1 0/7] mm/ksm: break_ksm() cleanups and fixes David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 1/7] selftests/vm: add test to measure MADV_UNMERGEABLE performance David Hildenbrand
2022-10-05 20:27 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 2/7] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 3/7] mm: remove VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29 ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 4/7] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE David Hildenbrand
2022-09-30 22:27 ` Andrew Morton
2022-10-01 8:13 ` David Hildenbrand
2022-10-05 20:35 ` Peter Xu
2022-10-06 9:29 ` David Hildenbrand
2022-10-06 19:04 ` Peter Xu
2022-10-20 10:05 ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 5/7] mm/pagewalk: add walk_page_range_vma() David Hildenbrand
2022-10-05 20:42 ` Peter Xu
2022-10-06 9:35 ` David Hildenbrand [this message]
2022-09-30 14:19 ` [PATCH v1 6/7] mm/ksm: convert break_ksm() to use walk_page_range_vma() David Hildenbrand
2022-10-05 21:00 ` Peter Xu
2022-10-06 9:20 ` David Hildenbrand
2022-10-06 19:28 ` Peter Xu
2022-10-21 9:11 ` David Hildenbrand
2022-10-20 8:59 ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 7/7] mm/gup: remove FOLL_MIGRATION David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=274c790a-04c7-078a-19be-851066dc21bb@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=shuah@kernel.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).