Re: [PATCH 3/4] mm/madvise: skip zone device folios in cold/pageout PMD range

From: Gregory Price

Date: Thu Aug 06 2026 - 13:24:07 EST


On Thu, Aug 06, 2026 at 03:23:25PM +0200, David Hildenbrand (Arm) wrote:
> On 7/28/26 21:47, Gregory Price wrote:
> > madvise_cold_or_pageout_pte_range() resolves the folio backing a PMD
> > via pmd_folio() and ages or reclaims it without checking for zone
> > device memory.
> >
> > The surrounding guards do not cover every zone device case:
> >
> > - can_madv_lru_vma() excludes VM_PFNMAP and VM_HUGETLB VMAs
> > (so device DAX is filtered)
> >
> > - !pmd_present() branch above rejects device-private and
> > migration entries, which are non-present.
> >
> > - A present zone device PMD - e.g. a device-coherent THP - is
> > not filtered by any of these, nor by pmd_folio() (unlike
> > vm_normal_page_pmd(), it performs no special/pfnmap check),
> > and would be aged or paged out here.
> >
> > Skip ZONE_DEVICE folios explicitly during MADV_COLD/PAGEOUT.
> >
>
> No fixes tag for this one required?
>

I think I convinced myself it was unreachable (PMD+Zone Device),
but I will double check Fixes and send a v2 with 1/4 dropped.

> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>

Thanks!