Re: [RFC PATCH 2/2] mm/migrate: wait for folio refcount during longterm pin migration

From: David Hildenbrand (Arm)

Date: Thu Apr 23 2026 - 09:28:28 EST


On 4/21/26 07:57, Alistair Popple wrote:
> On 2026-04-10 at 13:23 +1000, John Hubbard <jhubbard@xxxxxxxxxx> wrote...
>> When migrating pages for FOLL_LONGTERM pinning (MR_LONGTERM_PIN), the
>> migration can fail with -EAGAIN if the folio has unexpected references.
>> These references are often transient (e.g., from GPU operations like
>> cuMemset that will complete shortly).
>
> Is there a reason this logic should only apply to FOLL_LONGTERM pinning?
> Or could it also apply more generally to any ZONE_MOVABLE page, for which
> migration should eventually succeed? Currently that has similar retry logic of
> NR_MAX_MIGRATE_PAGES_RETRY times and give up.
>
> We have a similar retry problems in mm/migrate_device.c:migrate_vma_*() so I
> could see something similar being potentially useful there.

Agreed on both!

--
Cheers,

David