From: David Hildenbrand <david@redhat.com>
To: craftfever <craftfever@airmail.cc>,
Pedro Demarchi Gomes <pedrodemargomes@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Xu Xin <xu.xin16@zte.com.cn>,
Chengming Zhou <chengming.zhou@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] ksm: use range-walk function to jump over holes in scan_get_next_rmap_item
Date: Thu, 23 Oct 2025 12:13:57 +0200 [thread overview]
Message-ID: <33e299b9-8596-4ae2-b291-4b067dc32001@redhat.com> (raw)
In-Reply-To: <d06f4c9d-cf63-4bc4-859d-8256e16dd68d@airmail.cc>
>> break;
>>
>> - folio = folio_walk_start(&fw, vma, ksm_scan.address, 0);
>> - if (folio) {
>> - if (!folio_is_zone_device(folio) &&
>> - folio_test_anon(folio)) {
>> - folio_get(folio);
>> - tmp_page = fw.page;
>> - }
>> - folio_walk_end(&fw, vma);
>> + int found;
>> +
>> + found = walk_page_range_vma(vma, ksm_scan.address,
>> + vma->vm_end,
>> + &ksm_next_page_ops,
>> + &ksm_next_page_arg);
>> +
>> + if (found > 0) {
>> + folio = ksm_next_page_arg.folio;
>> + tmp_page = ksm_next_page_arg.page;
>> + ksm_scan.address = ksm_next_page_arg.addr;
>> + } else {
>> + VM_WARN_ON_ONCE(found < 0);
>> + ksm_scan.address = vma->vm_end - PAGE_SIZE;
>> }
>>
>> if (tmp_page) {
>
> Thank you, it works magnificently, very pleasent. Very low CPU-consuming
> and effective, no crashes. Is this a final version?
If there is no further feedback, yes.
--
Cheers
David / dhildenb
prev parent reply other threads:[~2025-10-23 10:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 3:58 Pedro Demarchi Gomes
2025-10-23 10:13 ` David Hildenbrand
2025-10-24 21:52 ` Pedro Demarchi Gomes
[not found] ` <d06f4c9d-cf63-4bc4-859d-8256e16dd68d@airmail.cc>
2025-10-23 10:13 ` David Hildenbrand [this message]
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=33e299b9-8596-4ae2-b291-4b067dc32001@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=craftfever@airmail.cc \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pedrodemargomes@gmail.com \
--cc=xu.xin16@zte.com.cn \
/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