mm-migrate_device-add-thp-splitting-during-migration.patch removed from -mm tree
The quilt patch titled
Subject: mm/migrate_device: add THP splitting during migration
has been removed from the -mm tree. Its filename was
mm-migrate_device-add-thp-splitting-during-migration.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/migrate_device: add THP splitting during migration
Date: Wed, 1 Oct 2025 16:57:02 +1000
Implement migrate_vma_split_pages() to handle THP splitting during the migration process when destination cannot allocate compound pages.
This addresses the common scenario where migrate_vma_setup() succeeds with MIGRATE_PFN_COMPOUND pages, but the destination device cannot allocate large pages during the migration phase.
Key changes:
- migrate_vma_split_pages(): Split already-isolated pages during migration
- Enhanced folio_split() and __split_unmapped_folio() with isolated parameter to avoid redundant unmap/remap operations
This provides a fallback mechansim to ensure migration succeeds even when large page allocation fails at the destination.
---
include/linux/huge_mm.h | 11 +++- lib/test_hmm.c | 9 +++ mm/huge_memory.c | 46 ++++++++++---------- mm/migrate_device.c | 87 +++++++++++++++++++++++++++++++++----- 4 files changed, 119 insertions(+), 34 deletions(-)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-migrate_device-add-thp-splitting-during-migration +9 -2
@@ -365,8 +365,8 @@ unsigned long thp_get_unmapped_area_vmfl vm_flags_t vm_flags);bool can_split_folio (struct folio *folio,int caller_pins,int *pextra_pins); -int split_huge_page_to_list_to_order (struct page *page,struct list_head *list, -unsigned int new_order); +int __split_huge_page_to_list_to_order (struct page *page,struct list_head *list, +unsigned int new_order,bool unmapped);int min_order_for_split (struct folio *folio);int split_folio_to_list (struct folio *folio,struct list_head *list); bool uniform_split_supported(struct folio *folio, unsigned int new_order,
@@ -375,6 +375,13 @@ bool non_uniform_split_supported(struct bool warns);int folio_split (struct folio *folio,unsigned int new_order,struct page *page,struct list_head *list); + +static inline int split_huge_page_to_list_to_order (struct page *page,struct list_head *list, +unsigned int new_order) +{ +return __split_huge_page_to_list_to_order (page, list, new_order, false); +} +/* * try_folio_split_to_order - try to split a @folio at @page to @new_order using * non uniform split.
lib/test_hmm.c renamed from lib/test_hmm.c~mm-migrate_device-add-thp-splitting-during-migration +9 -0
@@ -1613,6 +1613,15 @@ static vm_fault_t dmirror_devmem_fault(s nr =1 << order;/* +* When folios are partially mapped, we can't rely on the folio +* order of vmf->page as the folio might not be fully split yet +*/ +if (vmf->pte) { + order =0 ; + nr =1 ; + } + +/* * Consider a per-cpu cache of src and dst pfns, but with * large number of cpus that might not scale well. */
mm/huge_memory.c renamed from mm/huge_memory.c~mm-migrate_device-add-thp-splitting-during-migration +25 -21
114 lines not on this page · raw message
mm/migrate_device.c renamed from mm/migrate_device.c~mm-migrate_device-add-thp-splitting-during-migration +76 -11
132 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are