[merged mm-stable] mm-mincore-use-walk_page_range_vma-in-do_mincore.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 28 Jul 2026 21:13:42 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm: mincore: use walk_page_range_vma() in do_mincore()
has been removed from the -mm tree. Its filename was
mm-mincore-use-walk_page_range_vma-in-do_mincore.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kefeng Wang <[email protected]>
Subject: mm: mincore: use walk_page_range_vma() in do_mincore()
Date: Thu, 18 Jun 2026 17:28:42 +0800
Patch series "mm: convert to walk_page_range_vma() to eliminate
find_vma()", v2.
walk_page_range() performs a find_vma() lookup on each page table walk.
For callers that already hold a valid VMA and operate on a known
single-VMA range, this lookup is redundant. Replace walk_page_range()
with walk_page_range_vma() where the caller guarantees single-VMA
semantics.
This patch (of 4):
do_mincore() uses walk_page_range() to walk the page table. Fortunately,
the caller always passes start/end that falls within a single VMA, so it's
safe to use the walk_page_range_vma() in do_mincore() to eliminate 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.
[[email protected]: simplify comment, per Pedro]
Link: https://lore.kernel.org/ajP9bQhmvR9OX0VE@pedro-suse
Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Acked-by: Zi Yan <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Reviewed-by: Pedro Falcato <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Gregory Price <[email protected]>
Cc: Joshua Hahn <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Rakie Kim <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Ying Huang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/mincore.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/mm/mincore.c~mm-mincore-use-walk_page_range_vma-in-do_mincore
+++ a/mm/mincore.c
@@ -258,7 +258,16 @@ static long do_mincore(unsigned long add
memset(vec, 1, pages);
return pages;
}
- err = walk_page_range(vma->vm_mm, addr, end, &mincore_walk_ops, vec);
+
+ /*
+ * mincore historically reports PFNMAP mappings as non-resident.
+ */
+ if (vma->vm_flags & VM_PFNMAP) {
+ __mincore_unmapped_range(addr, end, vma, vec);
+ return (end - addr) >> PAGE_SHIFT;
+ }
+
+ err = walk_page_range_vma(vma, addr, end, &mincore_walk_ops, vec);
if (err < 0)
return err;
return (end - addr) >> PAGE_SHIFT;
_
Patches currently in -mm which might be from [email protected] are
mm-introduce-pud_is_huge-helper.patch
mm-mincore-remove-special-handling-for-vm_pfnmap.patch
mm-mincore-remove-special-handling-for-vm_pfnmap-fix.patch
mm-mincore-replace-__get_free_page-with-kmalloc.patch
mm-mincore-remove-xa_is_value-in-mincore_swap.patch
mm-mincore-improve-mincore_hugetlb.patch
mm-mincore-improve-mincore_hugetlb-fix.patch
mm-mincore-refactor-mincore_page.patch