[PATCH 2/2] drm/amdgpu: nuke amdgpu_vm_bo_split_mapping

Luben Tuikov luben.tuikov at amd.com
Thu Oct 15 18:10:23 UTC 2020


On 2020-10-15 03:04, Christian König wrote:
>>>   
>>> +	pfn = offset >> PAGE_SHIFT;
>>> +	if (nodes) {
>>> +		while (pfn >= nodes->size) {
>>> +			pfn -= nodes->size;
>>> +			++nodes;
>>> +		}
>>> +	}
>>> +
>> I believe here you can just do:
>>
>> 	if (nodes)
>> 		nodes += pfn / nodes->size;
>>
>> So long as pfn and nodes->size are non-negative
>> integers and nodes->size is non-zero, which
>> conditions appear to be satisfied.
> That won't work, the nodes->size is not constant but based on which bits 
> where set in the original allocation size.
> 
> In other words if you allocate 84KiB of memory you get node sizes of 
> 64KiB, 16KiB, 4KiB IIRC.
> 
> The exception is if we have an allocation larger than 2MiB and are in an 
> out of memory situation. In this case we cap at 2MiB allocations. But 
> this case is so rare that it is probably not worth the extra handling.

Ah, yes, thanks for clarifying.

Regards,
Luben


More information about the amd-gfx mailing list