Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Zi Yan <ziy@nvidia.com>, "Liam R. Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH 1/4] mm: mincore: try per-VMA lock firstly and use walk_page_range_vma()
Date: Thu, 18 Jun 2026 10:15:46 +0200	[thread overview]
Message-ID: <6f4a4ef5-0a23-4d89-9b34-a610299525d0@kernel.org> (raw)
In-Reply-To: <900d0057-9b21-4bb7-a53a-397079d301e3@huawei.com>

On 6/18/26 03:41, Kefeng Wang wrote:
> 
> 
> On 6/17/2026 11:01 PM, David Hildenbrand (Arm) wrote:
>> On 6/17/26 10:26, Kefeng Wang wrote:
>>> The mincore syscall currently takes mmap lock for the entire
>>> duration of the VMA lookup and page table walk. This creates
>>> a global contention point with page faults and other mmap_lock
>>> holders in multi-threaded applications.
>>>
>>> The mincore is a read-only operation that only queries page
>>> residency from a single VMA, making it an ideal candidate for
>>> per-VMA locking, so try per-vma lock firstly and use the
>>> walk_page_range_vma() in do_mincore() to eliminates an unnecessary
>>> find_vma() lookup.
>>>
>>> Unlike walk_page_range(), walk_page_range_vma() does not call
>>> walk_page_test(), which handles VM_PFNMAP by invoking ->pte_hole()
>>> to skip the page table walk. Without this check, PFNMAP PTEs
>>> would be treated as present by mincore_pte_range(), changing
>>> the returned residency status. Handle VM_PFNMAP explicitly in
>>> do_mincore() to preserve the original behavior.
>>>
>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>> ---
>>
>> I think you should first add a patch that converts do_mincore() to just use
>> walk_page_range_vma() -- which is what your patch series "mm: convert to
>> walk_page_range_vma() to eliminate find_vma()" wants to achieve.
>>
>> Which would already be an improvement :)
>>
> 
> Are you suggesting that the per-vma optimization should be separated
> out? This change is not too big, and I am fine with either, which
> method do you prefer?

Yes, I would split the "use "walk_page_range_vma" from "use per-VMA lock", even
though the first patch would be rather small.

-- 
Cheers,

David


  reply	other threads:[~2026-06-18  8:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  8:26 [PATCH 0/4] mm: convert to walk_page_range_vma() to eliminate find_vma() Kefeng Wang
2026-06-17  8:26 ` [PATCH 1/4] mm: mincore: try per-VMA lock firstly and use walk_page_range_vma() Kefeng Wang
2026-06-17 14:54   ` Zi Yan
2026-06-18  1:11     ` Kefeng Wang
2026-06-18  1:20       ` Zi Yan
2026-06-17 15:01   ` David Hildenbrand (Arm)
2026-06-18  1:41     ` Kefeng Wang
2026-06-18  8:15       ` David Hildenbrand (Arm) [this message]
2026-06-17  8:26 ` [PATCH 2/4] mm: mprotect: use walk_page_range_vma() in mprotect_fixup() Kefeng Wang
2026-06-17 13:25   ` David Hildenbrand (Arm)
2026-06-18  1:42     ` Kefeng Wang
2026-06-17 14:28   ` Zi Yan
2026-06-18  1:43     ` Kefeng Wang
2026-06-18  8:17   ` David Hildenbrand (Arm)
2026-06-17  8:26 ` [PATCH 3/4] mm: mlock: use walk_page_range_vma() in mlock_vma_pages_range() Kefeng Wang
2026-06-17 13:26   ` David Hildenbrand (Arm)
2026-06-17 14:35   ` Zi Yan
2026-06-18  8:16   ` David Hildenbrand (Arm)
2026-06-18  8:27     ` Kefeng Wang
2026-06-17  8:26 ` [PATCH 4/4] mm: migrate_device: use walk_page_range_vma() in migrate_vma_collect() Kefeng Wang
2026-06-17 13:30   ` David Hildenbrand (Arm)
2026-06-18  1:46     ` Kefeng Wang
2026-06-17 14:37   ` Zi Yan

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=6f4a4ef5-0a23-4d89-9b34-a610299525d0@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=ziy@nvidia.com \
    /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