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

From: David Hildenbrand (Arm)

Date: Mon Aug 17 2026 - 14:02:55 EST


On 8/17/26 18:39, Zi Yan wrote:
> 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>

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

I do wonder whether there should be a PMD helper.

--
Cheers,

David