Re: [PATCH v2 04/11] mm/migrate_device: Add migrate PFN flag to track device private pages

Jordan Niethe
2026-01-08T23:41:25Z

Hi,

On 9/1/26 07:01, Felix Kuehling wrote:
>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/
>> drm/amd/amdkfd/kfd_migrate.c
>> index c493b19268cc..1a07a8b92e8f 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> @@ -206,7 +206,12 @@ svm_migrate_copy_done(struct amdgpu_device *adev,
>> struct dma_fence *mfence)
>>   unsigned long
>>   svm_migrate_addr_to_mpfn(struct amdgpu_device *adev, unsigned long
>> addr)
>>   {
>> -    return migrate_pfn((addr + adev->kfd.pgmap.range.start) >>
>> PAGE_SHIFT);
>> +    unsigned long flags = 0;
>> +
>> +    if (!adev->gmc.xgmi.connected_to_cpu)
>
> We could probably use adev->kfd.pgmap.type == MEMORY_DEVICE_PRIVATE
> here. This avoids making any assumptions about how KFD decides device
> page type it wants to use, which may change on future HW generations.
>
> Other than that, this looks good to me.

That's a good point - I'll update.

Thanks for review,
Jordan.

>
> Thanks,
>   Felix
>
>