diff mbox series

drm/ttm: Make ttm shrinkers NUMA aware

Message ID 20240408174932.1546519-1-rajneesh.bhardwaj@amd.com (mailing list archive)
State New, archived
Headers show
Series drm/ttm: Make ttm shrinkers NUMA aware | expand

Commit Message

Rajneesh Bhardwaj April 8, 2024, 5:49 p.m. UTC
Otherwise the nid is always passed as 0 during memory reclaim so
make TTM shrinkers NUMA aware.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian König April 16, 2024, 8:38 a.m. UTC | #1
Am 08.04.24 um 19:49 schrieb Rajneesh Bhardwaj:
> Otherwise the nid is always passed as 0 during memory reclaim so
> make TTM shrinkers NUMA aware.
>
> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@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 dbc96984d331..514261f44b78 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -794,7 +794,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");

Well that won't do it.

Setting the flag is just one step, but both ttm_pool_shrinker_scan() and 
ttm_pool_type_count() needs to be made NUMA aware.

This means that allocated_pages needs to become a per NID array and 
ttm_pool_shrink() should not shrink any pooĺ but only those with the 
correct nid (if the nid is set).

Regards,
Christian.

>   	if (!mm_shrinker)
>   		return -ENOMEM;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index dbc96984d331..514261f44b78 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -794,7 +794,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");
 	if (!mm_shrinker)
 		return -ENOMEM;