mm-khugepaged-fix-pmd-collapse-swap-pte-accounting.patch removed from -mm tree
The quilt patch titled
Subject: mm/khugepaged: fix PMD collapse swap PTE accounting
has been removed from the -mm tree. Its filename was
mm-khugepaged-fix-pmd-collapse-swap-pte-accounting.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: Lance Yang <[email protected]>
Subject: mm/khugepaged: fix PMD collapse swap PTE accounting
Date: Tue, 9 Jun 2026 20:04:43 +0800
mthp_collapse() uses mthp_present_ptes to decide whether a range has enough occupied PTEs to try collapse. Swap PTEs accepted by collapse_scan_pmd() are counted in unmapped, but are not represented in mthp_present_ptes.
When lower orders are enabled, collapse_scan_pmd() relaxes max_ptes_none so the scan can cover the whole PMD and build the bitmap. mthp_collapse() then checks the PMD-order candidate using the bitmap.
With max_ptes_none set to 0, a range with 511 present PTEs and one swap PTE no longer reaches collapse_huge_page(), even though PMD collapse can handle swap PTEs up to max_ptes_swap.
Account unmapped PTEs only for PMD order. PMD collapse supports swap PTEs through max_ptes_swap, while lower-order mTHP collapse does not currently support non-present PTEs. Keep non-present PTEs out of the lower-order eligibility check.
---
mm/khugepaged.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-fix-pmd-collapse-swap-pte-accounting +8 -0
@@ -1502,6 +1502,14 @@ static enum scan_result mthp_collapse(st nr_occupied_ptes =bitmap_weight_from (cc->mthp_present_ptes, offset, offset + nr_ptes); +/* +* Swap PTEs accepted during the scan are counted in @unmapped, +* not in the present-PTE bitmap. Account them for the PMD-order +* candidate. +*/ +if (is_pmd_order (order)) + nr_occupied_ptes += unmapped; +if (nr_occupied_ptes >= nr_ptes - max_ptes_none) {enum scan_result ret;
_
Patches currently in -mm which might be from [email protected] are