Skip to contentSkip to conversation

mm-khugepaged-skip-collapsing-mthp-to-smaller-orders.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jun 21

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/khugepaged: skip collapsing mTHP to smaller orders
has been removed from the -mm tree. Its filename was
mm-khugepaged-skip-collapsing-mthp-to-smaller-orders.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: Nico Pache <[email protected]>
Subject: mm/khugepaged: skip collapsing mTHP to smaller orders
Date: Fri, 5 Jun 2026 10:14:14 -0600

khugepaged may try to collapse a mTHP to a folio of equal or smaller size, possibly resulting in a partially mapped source folio, which is undesired. Skip these cases until we have a way to check if its ok to collapse to a smaller mTHP size (like in the case of a partially mapped folio). This check is not done during the scan phase as the current collapse order is unknown at that time.

This patch is inspired by Dev Jain's work on khugepaged mTHP support [1].

Cc Alistair Popple <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc Bagas Sanjaya <[email protected]>
Cc Barry Song <[email protected]>
Cc Brendan Jackman <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David Rientjes <[email protected]>
Cc Gregory Price <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jan Kara <[email protected]>
Cc Jann Horn <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc "Masami Hiramatsu (Google)" <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Nanyong Sun <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Peter Xu <[email protected]>
Cc Rafael Aquini <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Shivank Garg <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Takashi Iwai (SUSE) <[email protected]>
Cc Thomas Hellström <[email protected]>
Cc Usama Arif <[email protected]>
Cc Vishal Moola (Oracle) <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Wei Yang <[email protected]>
Cc Will Deacon <[email protected]>
Cc Yang Shi <[email protected]>
Cc Zach O'Keefe <[email protected]>
Cc Zi Yan <[email protected]>

---

 mm/khugepaged.c |    8 ++++++++
 1 file changed, 8 insertions(+)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-skip-collapsing-mthp-to-smaller-orders +8 -0
@@ -697,6 +697,14 @@ static enum scan_result __collapse_huge_
 				goto out;
 			}
 		}
+		/*
+		 * TODO: In some cases of partially-mapped folios, we'd actually
+		 * want to collapse.
+		 */
+		if (!is_pmd_order(order) && folio_order(folio) >= order) {
+			result = SCAN_PTE_MAPPED_HUGEPAGE;
+			goto out;
+		}
 
 		if (folio_test_large(folio)) {
 			struct folio *f;

_

Patches currently in -mm which might be from [email protected] are