Re: [PATCH v3] mm: migrate: requeue destination folio on deferred split queue

From: Wei Yang

Date: Thu Mar 12 2026 - 21:18:28 EST


On Thu, Mar 12, 2026 at 03:47:23AM -0700, Usama Arif wrote:
>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 recording whether the source folio was on the deferred split
>queue and its partially mapped state before move_to_new_folio() unqueues
>it, and re-queuing the destination folio after a successful migration if
>it was.
>
>By the time migrate_folio_move() runs, partially mapped folios without a
>pin have already been split by migrate_pages_batch(). So only two cases
>remain on the deferred list at this point:
> 1. Partially mapped folios with a pin (split failed).
> 2. Fully mapped but potentially underused folios.
>The recorded partially_mapped state is forwarded to deferred_split_folio()
>so that the destination folio is correctly re-queued in both cases.
>
>Reported-by: Johannes Weiner <hannes@xxxxxxxxxxx>
>Fixes: dafff3f4c850 ("mm: split underused THPs")
>Acked-by: Zi Yan <ziy@xxxxxxxxxx>
>Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>

LGTM, thanks.

Reviewed-by: Wei Yang <richard.weiyang@xxxxxxxxx>

--
Wei Yang
Help you, Help me