linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: migrate: requeue destination folio on deferred split queue
@ 2026-03-06 13:35 Usama Arif
  2026-03-06 13:49 ` David Hildenbrand (Arm)
  2026-03-06 13:51 ` David Hildenbrand (Arm)
  0 siblings, 2 replies; 10+ messages in thread
From: Usama Arif @ 2026-03-06 13:35 UTC (permalink / raw)
  To: Andrew Morton, npache, david, ziy, linux-mm
  Cc: matthew.brost, joshua.hahnjy, hannes, rakie.kim, byungchul,
	gourry, ying.huang, apopple, linux-kernel, kernel-team,
	Usama Arif

During folio migration, __folio_migrate_mapping() removes the source
folio from the deferred split queue, but the destination folio is never
re-queued.  This causes underutilized THPs to escape the shrinker after
NUMA migration, since they silently drop off the deferred split list.

Fix this by calling deferred_split_folio() on the destination folio
after a successful migration, for large rmappable folios.

Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Fixes: dafff3f4c850 ("mm: split underused THPs")
Signed-off-by: Usama Arif <usama.arif@linux.dev>
---
 mm/migrate.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mm/migrate.c b/mm/migrate.c
index ece77ccb2ec0..98d0a594f7b7 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1393,6 +1393,17 @@ static int migrate_folio_move(free_folio_t put_new_folio, unsigned long private,
 	if (old_page_state & PAGE_WAS_MAPPED)
 		remove_migration_ptes(src, dst, 0);
 
+	/*
+	 * Requeue the destination folio on the deferred split queue if
+	 * the source was a large folio that was on the queue. Without
+	 * this, NUMA migration causes underutilized THPs to escape
+	 * the shrinker since the source is unqueued in
+	 * __folio_migrate_mapping() and the destination is never
+	 * re-queued.
+	 */
+	if (folio_test_large(dst) && folio_test_large_rmappable(dst))
+		deferred_split_folio(dst, false);
+
 out_unlock_both:
 	folio_unlock(dst);
 	folio_set_owner_migrate_reason(dst, reason);
-- 
2.47.3



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-06 16:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-06 13:35 [PATCH] mm: migrate: requeue destination folio on deferred split queue Usama Arif
2026-03-06 13:49 ` David Hildenbrand (Arm)
2026-03-06 14:12   ` Usama Arif
2026-03-06 14:46     ` Zi Yan
2026-03-06 16:15       ` Usama Arif
2026-03-06 16:23         ` David Hildenbrand (Arm)
2026-03-06 16:26         ` Zi Yan
2026-03-06 16:08     ` Matthew Wilcox
2026-03-06 16:19       ` Usama Arif
2026-03-06 13:51 ` David Hildenbrand (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox