Re: [PATCH v2 3/3] mm/mempolicy: skip zone device folios when queueing folios
From: David Hildenbrand (Arm)
Date: Tue Aug 18 2026 - 13:23:51 EST
On 8/18/26 00:08, Gregory Price wrote:
> queue_folios_pte_range() already pairs vm_normal_folio() with an
> explicit folio_is_zone_device() check before adding folios to the
> migration pagelist.
>
> vm_normal_folio() alone does not reject zone device memory (a present
> device-coherent page in a normal VMA is returned as "normal").
>
> Mirror the explicit check in queue_folios_pmd() as well.
>
> queue_folios_pmd() uses pmd_folio() directly and can encounter a present
> zone device PMD - e.g. a device-coherent THP.
>
> This is not filtered by existing checks:
> !pmd_present() - only rejects non-present device-private and
> migration entries
>
> vma_migratable() - excludes DAX and VM_PFNMAP.
>
> The early return also means such a folio is no longer counted in
> qp->nr_failed under MPOL_MF_STRICT. This is the same pattern used
> by queue_folios_pte_range() (skipping zone device without failing).
>
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> ---
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David