Re: [PATCH v2 3/5] drm/ttm: Introduce ttm_bo_shrink_kswap_fragmented()

Christian König
2026-04-30T07:40:05Z

On 4/30/26 08:23, Matthew Brost wrote:
> On Tue, Apr 28, 2026 at 12:07:07PM +0200, Andi Shyti wrote:
>> Hi Matt,
>>
>> ...
>>
>>> +/**
>>> + * ttm_bo_shrink_kswap_fragmented() - Whether in kswap and memory appears
>>> + * fragmented
>>> + * @nid: current node being shrunk
>>> + *
>>> + * Return: true if in kswap and memory appears fragmented, false is not.
>>> + */
>>> +bool ttm_bo_shrink_kswap_fragmented(int nid)
>>
>> This name is a bit to strong and misleading, in my opinion.
>>
>
> s/ttm_bo_shrink_kswap_fragmented/ttm_bo_shrink_kswap_maybe_fragmented
>

Maybe ttm_bo_partial_shrink_kswap() or something into that direction?

I don't really have any better idea either.

Regards,
Christian.

> ?
>
>>> +{
>>> + enum zone_type zone_type;
>>> +
>>> + if (!current_is_kswapd())
>>> + return false;
>>> +
>>> + if (!numa_valid_node(nid))
>>> + return false;
>>> +
>>> +#if IS_ENABLED(CONFIG_ZONE_DMA32)
>>> + zone_type = ZONE_DMA32;
>>> +#else
>>> + zone_type = ZONE_NORMAL;
>>> +#endif
>>> +
>>> + for (; zone_type <= ZONE_NORMAL; ++zone_type) {
>>
>> just start with "for (zone_type = 0; ... )" and you don't need
>> the ifdefs above.
>>
>
> I don't think that is correct. Zero could mean ZONE_DMA which is not
> relavent here.
>
> For example on BMG + raptor lake system, it clear ZONE_DMA is used.
>
> cat /proc/buddyinfo
> Node 0, zone DMA 0 1 0 0 0 0 0 0 1 1 3
> Node 0, zone DMA32 20 10 11 14 15 15 11 13 13 8 232
> Node 0, zone Normal 876 1782 6 5 4 4 2 6 4 2 7107
>
> Matt
>
>> Andi
>>
>>> + struct zone *zone = &NODE_DATA(nid)->node_zones[zone_type];