mm-migrate-move-movable_ops-page-handling-out-of-move_to_new_folio.patch removed from -mm tree
The quilt patch titled
Subject: mm/migrate: move movable_ops page handling out of move_to_new_folio()
has been removed from the -mm tree. Its filename was
mm-migrate-move-movable_ops-page-handling-out-of-move_to_new_folio.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: David Hildenbrand <[email protected]>
Subject: mm/migrate: move movable_ops page handling out of move_to_new_folio()
Date: Fri, 4 Jul 2025 12:25:05 +0200
Let's move that handling directly into migrate_folio_move(), so we can simplify move_to_new_folio(). While at it, fixup the documentation a bit.
Note that unmap_and_move_huge_page() does not care, because it only deals with actual folios. (we only support migration of individual movable_ops pages)
---
mm/migrate.c | 63 +++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 33 deletions(-)
mm/migrate.c renamed from mm/migrate.c~mm-migrate-move-movable_ops-page-handling-out-of-move_to_new_folio +30 -33
@@ -1026,11 +1026,12 @@ static int fallback_migrate_folio(struct }/* -* Move a page to a newly allocated page -* The page is locked and all ptes have been successfully removed. +* Move a src folio to a newly allocated dst folio. * -* The new page will have replaced the old page if this function -* is successful. +* The src and dst folios are locked and the src folios was unmapped from +* the page tables. +* +* On success, the src folio was replaced by the dst folio. * * Return value: * < 0 - error code
@@ -1039,34 +1040,30 @@ static int fallback_migrate_folio(structstatic int move_to_new_folio (struct folio *dst,struct folio *src,enum migrate_mode mode) { +struct address_space *mapping =folio_mapping (src);int rc = -EAGAIN ; -bool is_lru = !__folio_test_movable (src);VM_BUG_ON_FOLIO (!folio_test_locked (src), src);VM_BUG_ON_FOLIO (!folio_test_locked (dst), dst); -if (likely (is_lru)) { -struct address_space *mapping =folio_mapping (src); - -if (!mapping) - rc =migrate_folio (mapping, dst, src, mode); -else if (mapping_inaccessible (mapping)) - rc = -EOPNOTSUPP ; -else if (mapping->a_ops->migrate_folio) -/* -* Most folios have a mapping and most filesystems -* provide a migrate_folio callback. Anonymous folios -* are part of swap space which also has its own -* migrate_folio callback. This is the most common path -* for page migration. -*/ - rc = mapping->a_ops->migrate_folio (mapping, dst, src, - mode); -else - rc =fallback_migrate_folio (mapping, dst, src, mode); +if (!mapping) + rc =migrate_folio (mapping, dst, src, mode); +else if (mapping_inaccessible (mapping)) + rc = -EOPNOTSUPP ; +else if (mapping->a_ops->migrate_folio) +/* +* Most folios have a mapping and most filesystems +* provide a migrate_folio callback. Anonymous folios +* are part of swap space which also has its own +* migrate_folio callback. This is the most common path +* for page migration. +*/ + rc = mapping->a_ops->migrate_folio (mapping, dst, src, + mode); +else + rc =fallback_migrate_folio (mapping, dst, src, mode); -if (rc !=MIGRATEPAGE_SUCCESS ) - goto out; +if (rc ==MIGRATEPAGE_SUCCESS ) {/* * For pagecache folios, src->mapping must be cleared before src * is freed. Anonymous folios must stay anonymous until freed.
@@ -1076,10 +1073,7 @@ static int move_to_new_folio(struct foliif (likely (!folio_is_zone_device (dst)))flush_dcache_folio (dst); - }else { - rc =migrate_movable_ops_page (&dst->page, &src->page, mode); } -out:return rc; }
@@ -1330,20 +1324,23 @@ static int migrate_folio_move(free_folioint rc;int old_page_state =0 ;struct anon_vma *anon_vma =NULL ; -bool is_lru = !__folio_test_movable (src);struct list_head *prev;__migrate_folio_extract (dst, &old_page_state, &anon_vma); prev = dst->lru.prev;list_del (&dst->lru); +if (unlikely (__folio_test_movable (src))) { + rc =migrate_movable_ops_page (&dst->page, &src->page, mode); +if (rc) + goto out; + goto out_unlock_both; + } + rc =move_to_new_folio (dst, src, mode);if (rc) goto out; -if (unlikely (!is_lru)) - goto out_unlock_both; -/* * When successful, push dst to LRU immediately: so that if it * turns out to be an mlocked page, remove_migration_ptes() will
_
Patches currently in -mm which might be from [email protected] are
mm-convert-fpb_ignore_-into-fpb_respect_.patch mm-smaller-folio_pte_batch-improvements.patch mm-split-folio_pte_batch-into-folio_pte_batch-and-folio_pte_batch_flags.patch mm-remove-boolean-output-parameters-from-folio_pte_batch_ext.patch mm-memory-introduce-is_huge_zero_pfn-and-use-it-in-vm_normal_page_pmd.patch