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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to