[PATCH 14/46] mm/huge_memory: fix zapping migration entries for device-private THPs

Zi Yan ziy at nvidia.com
Tue Oct 27 19:58:30 PDT 2026


On Mon Oct 26, 2026 at 7:17 PM EDT, David Hildenbrand (Arm) wrote:
> From: Chris Mason <mason at kernel.org>
>
> A PMD migration entry can refer to a device-private folio.

Right, set_pmd_migration_entry() does that when a device private folio
is migrated back to system memory.

> zap_huge_pmd_folio() checks the folio type instead of the entry type,
> so it treats such a migration entry as a device-private entry.
>
> Installing the migration entry already removed the reverse mapping and
> dropped the mapping reference. Zapping it must not repeat those
> operations. Concurrent MADV_DONTNEED during migration back to system
> memory can trigger this.
>
> Check the PMD entry type using pmd_is_device_private_entry().
>
> Fix generated by an LLM and sent by Chris Mason in private.
>
> Fixes: 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations")
> Cc: stable at vger.kernel.org
> Signed-off-by: Chris Mason <mason at kernel.org>
> [ david: simplify description ]
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>
> ---
>  mm/huge_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Zi Yan <ziy at nvidia.com>


-- 
Best Regards,
Yan, Zi




More information about the kexec mailing list