[merged mm-stable] mm-mincore-improve-mincore_hugetlb.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: improve mincore_hugetlb()
has been removed from the -mm tree. Its filename was
mm-mincore-improve-mincore_hugetlb.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: improve mincore_hugetlb()
Date: Fri, 17 Jul 2026 17:13:46 +0800
walk_hugetlb_range() always passes a non-NULL pte, so remove the dead NULL
check. Replace the per-page iteration loop with memset() for better
performance.
[[email protected]: fixup improve mincore_hugetlb()]
Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Reviewed-by: Pedro Falcato <[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: Vlastimil Babka <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/mincore.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
--- a/mm/mincore.c~mm-mincore-improve-mincore_hugetlb
+++ a/mm/mincore.c
@@ -28,30 +28,16 @@ static int mincore_hugetlb(pte_t *pte, u
unsigned long end, struct mm_walk *walk)
{
#ifdef CONFIG_HUGETLB_PAGE
- unsigned char present;
- unsigned char *vec = walk->private;
+ const unsigned long nr = (end - addr) >> PAGE_SHIFT;
+ unsigned char resident;
spinlock_t *ptl;
+ pte_t ptep;
ptl = huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte);
-
- /*
- * Hugepages under user process are always in RAM and never
- * swapped out, but theoretically it needs to be checked.
- */
- if (!pte) {
- present = 0;
- } else {
- const pte_t ptep = huge_ptep_get(walk->mm, addr, pte);
-
- if (huge_pte_none(ptep) || pte_is_marker(ptep))
- present = 0;
- else
- present = 1;
- }
-
- for (; addr != end; vec++, addr += PAGE_SIZE)
- *vec = present;
- walk->private = vec;
+ ptep = huge_ptep_get(walk->mm, addr, pte);
+ resident = !huge_pte_none(ptep) && !pte_is_marker(ptep);
+ memset(walk->private, resident, nr);
+ walk->private += nr;
spin_unlock(ptl);
#else
BUG();
_
Patches currently in -mm which might be from [email protected] are