Skip to contentSkip to conversation

mm-huge_memory-add-device-private-thp-support-to-pmd-operations.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Nov 24, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/huge_memory: add device-private THP support to PMD operations
has been removed from the -mm tree. Its filename was
mm-huge_memory-add-device-private-thp-support-to-pmd-operations.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: Balbir Singh <[email protected]>
Subject: mm/huge_memory: add device-private THP support to PMD operations
Date: Wed, 1 Oct 2025 16:56:54 +1000

Extend core huge page management functions to handle device-private THP entries. This enables proper handling of large device-private folios in fundamental MM operations.

The following functions have been updated:

- copy_huge_pmd(): Handle device-private entries during fork/clone
- zap_huge_pmd(): Properly free device-private THP during munmap
- change_huge_pmd(): Support protection changes on device-private THP
- __pte_offset_map(): Add device-private entry awareness

Cc David Hildenbrand <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Gregory Price <[email protected]>
Cc Ying Huang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Baolin Wang <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Nico Pache <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Dev Jain <[email protected]>
Cc Barry Song <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Cc Ralph Campbell <[email protected]>
Cc Mika Penttilä <[email protected]>
Cc Francois Dugast <[email protected]>

---

 include/linux/swapops.h |   32 +++++++++++++++++++++
 mm/huge_memory.c        |   56 +++++++++++++++++++++++++++++++-------
 mm/pgtable-generic.c    |    2 -
 3 files changed, 80 insertions(+), 10 deletions(-)
include/linux/swapops.h renamed from include/linux/swapops.h~mm-huge_memory-add-device-private-thp-support-to-pmd-operations +32 -0
@@ -594,10 +594,42 @@ static inline int is_pmd_migration_entry
 }
 #endif  /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
 
+#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_ARCH_ENABLE_THP_MIGRATION)
+
+/**
+ * is_pmd_device_private_entry() - Check if PMD contains a device private swap entry
+ * @pmd: The PMD to check
+ *
+ * Returns true if the PMD contains a swap entry that represents a device private
+ * page mapping. This is used for zone device private pages that have been
+ * swapped out but still need special handling during various memory management
+ * operations.
+ *
+ * Return: 1 if PMD contains device private entry, 0 otherwise
+ */
+static inline int is_pmd_device_private_entry(pmd_t pmd)
+{
+	return is_swap_pmd(pmd) && is_device_private_entry(pmd_to_swp_entry(pmd));
+}
+
+#else /* CONFIG_ZONE_DEVICE && CONFIG_ARCH_ENABLE_THP_MIGRATION */
+
+static inline int is_pmd_device_private_entry(pmd_t pmd)
+{
+	return 0;
+}
+
+#endif /* CONFIG_ZONE_DEVICE && CONFIG_ARCH_ENABLE_THP_MIGRATION */
+
 static inline int non_swap_entry(swp_entry_t entry)
 {
 	return swp_type(entry) >= MAX_SWAPFILES;
 }
 
+static inline int is_pmd_non_present_folio_entry(pmd_t pmd)
+{
+	return is_pmd_migration_entry(pmd) || is_pmd_device_private_entry(pmd);
+}
+
 #endif /* CONFIG_MMU */
 #endif /* _LINUX_SWAPOPS_H */
mm/huge_memory.c renamed from mm/huge_memory.c~mm-huge_memory-add-device-private-thp-support-to-pmd-operations +47 -9

98 lines not on this page · raw message

mm/pgtable-generic.c renamed from mm/pgtable-generic.c~mm-huge_memory-add-device-private-thp-support-to-pmd-operations +1 -1
@@ -292,7 +292,7 @@ pte_t *___pte_offset_map(pmd_t *pmd, uns
 
 	if (pmdvalp)
 		*pmdvalp = pmdval;
-	if (unlikely(pmd_none(pmdval) || is_pmd_migration_entry(pmdval)))
+	if (unlikely(pmd_none(pmdval) || !pmd_present(pmdval)))
 		goto nomap;
 	if (unlikely(pmd_trans_huge(pmdval)))
 		goto nomap;

_

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