Re: [PATCH v2 02/11] drm/amdkfd: Use migrate pfns internally

Jordan Niethe
2026-01-08T23:57:30Z

Hi,

On 9/1/26 09:00, Felix Kuehling wrote:
>
>> @@ -235,7 +235,7 @@ svm_migrate_addr(struct amdgpu_device *adev,
>> struct page *page)
>>   {
>>       unsigned long addr;
>> -    addr = page_to_pfn(page) << PAGE_SHIFT;
>> +    addr = (migrate_pfn_from_page(page) >> MIGRATE_PFN_SHIFT) <<
>> PAGE_SHIFT;
>>       return (addr - adev->kfd.pgmap.range.start);
>
> I guess we rely on the fact that for DEVICE_PRIVATE memory, adev-
> >kfd.pgmap.range.start will be 0 after your patch 11. So we don't need
> a special condition here to handle DEVICE_PRIVATE differently.

Actually pgmap.range.start won't be zero - part of the change to the
memremap_device_private_pagemap() in patch 11 is that range is used as an
output parameter. It returns the range we allocate for the pagemap from the
device_private_pgmap_tree maple tree, representing "device private address
space".

But it's correct that means we don't need special handling here.

>
> In general, I like the way you handle mpfns as it keeps all the special
> casing out of the drivers.

Yeah, it does turn out quite neat.

Thanks for review,
Jordan.

>
> Regards,
>   Felix
>
>