Skip to contentSkip to conversation

ttm/pool: Don't leak LRU list on shutdown

PATCH Applied Ian Forbes 4 participants 4 messages May 27 – Nov 23

Subsystems (3)
lore
Share & tools
lore

Ian Forbes

author
#0 lore raw

PATCH 1/1 ttm/pool: Don't leak LRU list on shutdown

TTM pool was changed from a regular list to an lru list in the referenced fixes commit. list_lru_init allocates state and it needs to be freed unlike a simple list.

Found using the igt@core_hotunplug and kmemleak.

Fixes 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
---
 drivers/gpu/drm/ttm/ttm_pool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_pool.c +1 -0
index 26a3689e5fd9..a41addbf3ddf 100644
@@ -395,6 +395,7 @@ static void ttm_pool_type_fini(struct ttm_pool_type *pt)
 
 	list_lru_walk(&pt->pages, pool_move_to_dispose_list, &dispose, LONG_MAX);
 	ttm_pool_dispose_list(pt, &dispose);
+	list_lru_destroy(&pt->pages);
 }
 
 /* Return the pool_type to use for the given caching and order */
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Ian Forbes

TTM pool was changed from a regular list to an lru list in the referenced fixes commit. list_lru_init allocates state and it needs to be freed unlike a simple list.

Found using the igt@core_hotunplug and kmemleak.

Fixes 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
Quoted 16 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_pool.c +1 -0
index 26a3689e5fd9..a41addbf3ddf 100644
@@ -395,6 +395,7 @@ static void ttm_pool_type_fini(struct ttm_pool_type *pt)
 
 	list_lru_walk(&pt->pages, pool_move_to_dispose_list, &dispose, LONG_MAX);
 	ttm_pool_dispose_list(pt, &dispose);
+	list_lru_destroy(&pt->pages);
 }
 
 /* Return the pool_type to use for the given caching and order */
#2 lore raw
Quoted 22 lines · Christian König
Quoted 8 lines · Ian Forbes

TTM pool was changed from a regular list to an lru list in the referenced fixes commit. list_lru_init allocates state and it needs to be freed unlike a simple list.

Found using the igt@core_hotunplug and kmemleak.

Fixes 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
Quoted 10 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_pool.c +0 -0
index 26a3689e5fd9..a41addbf3ddf 100644
@@ -395,6 +395,7 @@ static void ttm_pool_type_fini(struct ttm_pool_type *pt)
 
Quoted 6 lines

drivers/gpu/drm/ttm/ttm_pool.c static void ttm_pool_type_fini(struct ttm_pool_type *pt) · line 401

Quoted 6 lines
drivers/gpu/drm/ttm/ttm_pool.c +1 -0
 	list_lru_walk(&pt->pages, pool_move_to_dispose_list, &dispose, LONG_MAX);
 	ttm_pool_dispose_list(pt, &dispose);
+	list_lru_destroy(&pt->pages);
 }
 
 /* Return the pool_type to use for the given caching and order */

The patch probably fell through the cracks. Can't find it at drm-tip.git. Would you apply this, please?

maintainer Applied
#3 lore raw

Thanks,

Pushed to drm-misc-fixes now.

Dave.

Quoted 33 lines · Fedor Pchelkin
Quoted 22 lines · Christian König
Quoted 8 lines · Ian Forbes

TTM pool was changed from a regular list to an lru list in the referenced fixes commit. list_lru_init allocates state and it needs to be freed unlike a simple list.

Found using the igt@core_hotunplug and kmemleak.

Fixes 444e2a19d7fd ("ttm/pool: port to list_lru. (v2)")
Quoted 10 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_pool.c +0 -0
index 26a3689e5fd9..a41addbf3ddf 100644
@@ -395,6 +395,7 @@ static void ttm_pool_type_fini(struct ttm_pool_type *pt)
 
Quoted 6 lines

drivers/gpu/drm/ttm/ttm_pool.c static void ttm_pool_type_fini(struct ttm_pool_type *pt) · line 401

Quoted 6 lines
drivers/gpu/drm/ttm/ttm_pool.c +1 -0
    list_lru_walk(&pt->pages, pool_move_to_dispose_list, &dispose, LONG_MAX);
    ttm_pool_dispose_list(pt, &dispose);
+   list_lru_destroy(&pt->pages);
 }
 
 /* Return the pool_type to use for the given caching and order */

The patch probably fell through the cracks. Can't find it at drm-tip.git. Would you apply this, please?