[PATCH 2/2] drm/ttm: Make ttm shrinkers NUMA aware

Christian König christian.koenig at amd.com
Wed Jul 3 06:53:41 UTC 2024


Am 02.07.24 um 23:54 schrieb Bhardwaj, Rajneesh:
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig at amd.com>
> Sent: Tuesday, July 2, 2024 2:25 PM
> To: Alex Deucher <alexdeucher at gmail.com>; Bhardwaj, Rajneesh <Rajneesh.Bhardwaj at amd.com>; Maling list - DRI developers <dri-devel at lists.freedesktop.org>
> Cc: amd-gfx at lists.freedesktop.org; Kuehling, Felix <Felix.Kuehling at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: Re: [PATCH 2/2] drm/ttm: Make ttm shrinkers NUMA aware
>
>
>
> Am 02.07.24 um 20:20 schrieb Alex Deucher:
>> + dri-devel
>>
>> On Tue, Jul 2, 2024 at 1:40 PM Rajneesh Bhardwaj
>> <rajneesh.bhardwaj at amd.com> wrote:
>>> Otherwise the nid is always passed as 0 during memory reclaim so make
>>> TTM shrinkers NUMA aware.
>>>
>>> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj at amd.com>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c
>>> b/drivers/gpu/drm/ttm/ttm_pool.c index cc27d5c7afe8..f93ac9089a60
>>> 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_pool.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
>>> @@ -812,7 +812,7 @@ int ttm_pool_mgr_init(unsigned long num_pages)
>>>                               &ttm_pool_debugfs_shrink_fops);
>>>    #endif
>>>
>>> -       mm_shrinker = shrinker_alloc(0, "drm-ttm_pool");
>>> +       mm_shrinker = shrinker_alloc(SHRINKER_NUMA_AWARE,
>>> + "drm-ttm_pool");
> You also need to make ttm_pool_shrink() actually use the nid.
>
> Yeah, Did you mean setting the nid of the shrinker control structure from something like ttm_global_init() -passes NUMA node id dev_to_node(dev) to ttm_pool_mgr_init and use it to set the mm_shrinker->sc.nid ?

No, the nid needs to be passed in as parameter to ttm_pool_shrink(). See 
function ttm_pool_shrinker_scan()

Regards,
Christian.

>
> Just setting the flag won't really help us.
>
> Regards,
> Christian.
>
>>>           if (!mm_shrinker)
>>>                   return -ENOMEM;
>>>
>>> --
>>> 2.34.1
>>>



More information about the amd-gfx mailing list