* [withdrawn] mm-khugepaged-count-small-vmas-towards-scan-limit.patch removed from -mm tree
@ 2026-01-23 15:31 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-01-23 15:31 UTC (permalink / raw)
To: mm-commits, ziy, ryan.roberts, richard.weiyang, npache,
lorenzo.stoakes, Liam.Howlett, lance.yang, dev.jain, david,
baolin.wang, baohua, anshuman.khandual, shivankg, akpm
The quilt patch titled
Subject: mm/khugepaged: count small VMAs towards scan limit
has been removed from the -mm tree. Its filename was
mm-khugepaged-count-small-vmas-towards-scan-limit.patch
This patch was dropped because it was withdrawn
------------------------------------------------------
From: Shivank Garg <shivankg@amd.com>
Subject: mm/khugepaged: count small VMAs towards scan limit
Date: Sun, 18 Jan 2026 19:22:55 +0000
The khugepaged_scan_mm_slot() uses a 'progress' counter to limit the
amount of work performed and consists of three components:
1. Transitioning to a new mm (+1).
2. Skipping an unsuitable VMA (+1).
3. Scanning a PMD-sized range (+HPAGE_PMD_NR).
Consider a 1MB VMA sitting between two 2MB alignment boundaries:
vma1 vma2 vma3
+----------+------+----------+
|2M |1M |2M |
+----------+------+----------+
^ ^
start end
^
hstart,hend
In this case, for vma2:
hstart = round_up(start, HPAGE_PMD_SIZE) -> Next 2MB alignment
hend = round_down(end, HPAGE_PMD_SIZE) -> Prev 2MB alignment
Currently, since `hend <= hstart`, VMAs that are too small or unaligned to
contain a hugepage are skipped without incrementing 'progress'. A process
containing a large number of such small VMAs will unfairly consume more
CPU cycles before yielding compared to a process with fewer, larger, or
aligned VMAs.
Fix this by incrementing progress when the `hend <= hstart` condition
is met.
Additionally, change 'progress' type to `unsigned int` to match both the
'pages' type and the function return value.
Link: https://lkml.kernel.org/r/20260118192253.9263-8-shivankg@amd.com
Signed-off-by: Shivank Garg <shivankg@amd.com>
Suggested-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand (Red Hat) <david@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/khugepaged.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/mm/khugepaged.c~mm-khugepaged-count-small-vmas-towards-scan-limit
+++ a/mm/khugepaged.c
@@ -2403,7 +2403,7 @@ static unsigned int khugepaged_scan_mm_s
struct mm_slot *slot;
struct mm_struct *mm;
struct vm_area_struct *vma;
- int progress = 0;
+ unsigned int progress = 0;
VM_BUG_ON(!pages);
lockdep_assert_held(&khugepaged_mm_lock);
@@ -2447,7 +2447,8 @@ static unsigned int khugepaged_scan_mm_s
}
hstart = round_up(vma->vm_start, HPAGE_PMD_SIZE);
hend = round_down(vma->vm_end, HPAGE_PMD_SIZE);
- if (khugepaged_scan.address > hend) {
+ if (khugepaged_scan.address > hend || hend <= hstart) {
+ /* VMA already scanned or too small/unaligned for hugepage. */
progress++;
continue;
}
_
Patches currently in -mm which might be from shivankg@amd.com are
mm-khugepaged-map-dirty-writeback-pages-failures-to-eagain.patch
mm-khugepaged-retry-with-sync-writeback-for-madv_collapse.patch
mm-khugepaged-remove-unnecessary-goto-skip-label.patch
mm-khugepaged-change-collapse_pte_mapped_thp-to-return-void.patch
mm-khugepaged-use-enum-scan_result-for-result-variables-and-return-types.patch
mm-khugepaged-make-khugepaged_collapse_control-static.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-23 15:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 15:31 [withdrawn] mm-khugepaged-count-small-vmas-towards-scan-limit.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.