Re: [PATCH v3 3/6] mm/rmap: use huge_ptep_get() in try_to_migrate_one()

From: David Hildenbrand (Arm)

Date: Mon Jul 06 2026 - 05:08:33 EST


On 7/3/26 13:41, Dev Jain wrote:
> try_to_migrate_one() is used by folio migration to replace a present
> mapping with a migration entry. For hugetlb folios, page_vma_mapped_walk()
> returns the pte pointer to the hugetlb folio in pvmw.pte, but the code
> reads the huge pte entry with ptep_get().
>
> On arches which provide their own huge_ptep_get() to dereference a huge
> pte pointer, accessing via ptep_get() would cause pte_pfn(), pte_present()
> etc to misbehave.
>
> It is not clear whether this has a trivially visible effect to userspace.
>
> Use huge_ptep_get() to dereference a huge pte pointer.
>
> Commit a98a2f0c8ce1 copied the bug from try_to_unmap_one into
> try_to_migrate_one.
>
> Fixes: a98a2f0c8ce1 ("mm/rmap: split migration into its own function")
> Cc: stable@xxxxxxxxxxxxxxx
> Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
> ---

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

--
Cheers,

David