[merged mm-stable] mm-mincore-remove-special-handling-for-vm_pfnmap.patch removed from -mm tree
Andrew Morton <[email protected]>
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm: mincore: remove special handling for VM_PFNMAP
has been removed from the -mm tree. Its filename was
mm-mincore-remove-special-handling-for-vm_pfnmap.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: remove special handling for VM_PFNMAP
Date: Fri, 17 Jul 2026 17:13:43 +0800
As David pointed out, "it's hard to believe that someone depends on pages
in VM_PFNMAP to *not* be present", so remove the historical behavior that
always reports VM_PFNMAP pages as non-resident.
Adding mincore_pud_range() allows the page table walker to traverse the
full page table hierarchy without splitting a huge PUD, enabling much more
precise identification of resident pages in PFNMAP VMAs.
[[email protected]: address David's comments]
Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/linux-mm/[email protected]/
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Suggested-by: David Hildenbrand (Arm) <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Pedro Falcato <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/mincore.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
--- a/mm/mincore.c~mm-mincore-remove-special-handling-for-vm_pfnmap
+++ a/mm/mincore.c
@@ -160,6 +160,20 @@ static int mincore_unmapped_range(unsign
return 0;
}
+static int mincore_pud_entry(pud_t *pudp, unsigned long addr, unsigned long end,
+ struct mm_walk *walk)
+{
+ if (pud_is_huge(pudp_get(pudp))) {
+ const unsigned long nr = (end - addr) >> PAGE_SHIFT;
+
+ memset(walk->private, 1, nr);
+ walk->private += nr;
+ walk->action = ACTION_CONTINUE;
+ }
+
+ return 0;
+}
+
static int mincore_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
@@ -232,6 +246,7 @@ static inline bool can_do_mincore(struct
}
static const struct mm_walk_ops mincore_walk_ops = {
+ .pud_entry = mincore_pud_entry,
.pmd_entry = mincore_pte_range,
.pte_hole = mincore_unmapped_range,
.hugetlb_entry = mincore_hugetlb,
@@ -259,14 +274,6 @@ static long do_mincore(unsigned long add
return pages;
}
- /*
- * 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;
_
Patches currently in -mm which might be from [email protected] are