Re: [PATCH] mm/migrate_device: fix cache flush when replacing huge zero PMD

From: Zi Yan

Date: Mon Aug 17 2026 - 12:44:36 EST


On Mon Aug 17, 2026 at 2:08 AM EDT, Hui Su wrote:
> migrate_vma_insert_huge_pmd_page() calls flush_cache_page() before
> replacing an existing huge zero PMD. However, the third argument to
> flush_cache_page() is a PFN, while addr + HPAGE_PMD_SIZE is an end
> virtual address.
>
> More importantly, the mapping being invalidated is PMD-sized rather
> than PAGE_SIZE-sized. Flush the whole PMD range with
> flush_cache_range(), matching other huge PMD invalidation paths.
>
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Signed-off-by: Hui Su <sh_def@xxxxxxx>
> ---
> mm/migrate_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Thank you for fixing it.

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>



--
Best Regards,
Yan, Zi