Skip to content

Commit b057f37

Browse files
drm/ttm: re-add debugfs tt_shrink file
That got lost when we moved back to a static limit. Signed-off-by: Christian König <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a28e10e commit b057f37

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/gpu/drm/ttm/ttm_tt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,33 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm)
389389
ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
390390
}
391391

392+
#ifdef CONFIG_DEBUG_FS
393+
394+
/* Test the shrinker functions and dump the result */
395+
static int ttm_tt_debugfs_shrink_show(struct seq_file *m, void *data)
396+
{
397+
struct ttm_operation_ctx ctx = { false, false };
398+
399+
seq_printf(m, "%d\n", ttm_global_swapout(&ctx, GFP_KERNEL));
400+
return 0;
401+
}
402+
DEFINE_SHOW_ATTRIBUTE(ttm_tt_debugfs_shrink);
403+
404+
#endif
405+
406+
392407
/**
393408
* ttm_tt_mgr_init - register with the MM shrinker
394409
*
395410
* Register with the MM shrinker for swapping out BOs.
396411
*/
397412
void ttm_tt_mgr_init(unsigned long num_pages, unsigned long num_dma32_pages)
398413
{
414+
#ifdef CONFIG_DEBUG_FS
415+
debugfs_create_file("tt_shrink", 0400, ttm_debugfs_root, NULL,
416+
&ttm_tt_debugfs_shrink_fops);
417+
#endif
418+
399419
if (!ttm_pages_limit)
400420
ttm_pages_limit = num_pages;
401421

0 commit comments

Comments
 (0)