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

David Hildenbrand (Arm)
2026-04-23T13:22:26Z

On 4/21/26 07:57, Alistair Popple wrote:
> On 2026-04-10 at 13:23 +1000, John Hubbard <jhubbard@nvidia.com> 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