diff options
| author | Mario Limonciello <mario.limonciello@amd.com> | 2026-04-27 11:22:53 -0500 |
|---|---|---|
| committer | Mario Limonciello <superm1@kernel.org> | 2026-06-30 00:09:38 -0500 |
| commit | 811a8d6f2c2d89471dd1ae71c293bb6753fb31ee (patch) | |
| tree | 1d7554d8cdff12a4f35cad4dbe4e8e44dbff5f7a /drivers | |
| parent | 723a2a698fa6521ef4f346b7d51f8d2ede107e6a (diff) | |
| download | linux-next-811a8d6f2c2d89471dd1ae71c293bb6753fb31ee.tar.gz linux-next-811a8d6f2c2d89471dd1ae71c293bb6753fb31ee.zip | |
ttm/pool: Use sentinels in debugfs
The values in the `page_pool_shrink` debugfs file should recognize
the sentinels rather than causing an underflow.
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5218
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://patch.msgid.link/20260427162253.682415-1-mario.limonciello@amd.com
Signed-off-by: Mario Limonciello <superm1@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_pool.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 682ae4f40424..3d5f2ae0a456 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -1355,15 +1355,22 @@ static int ttm_pool_debugfs_shrink_show(struct seq_file *m, void *data) .gfp_mask = GFP_NOFS, .nr_to_scan = TTM_SHRINKER_BATCH, }; - unsigned long count; + unsigned long count, scanned; int nid; fs_reclaim_acquire(GFP_KERNEL); for_each_node(nid) { sc.nid = nid; count = ttm_pool_shrinker_count(mm_shrinker, &sc); - seq_printf(m, "%d: %lu/%lu\n", nid, count, - ttm_pool_shrinker_scan(mm_shrinker, &sc)); + scanned = ttm_pool_shrinker_scan(mm_shrinker, &sc); + + /* Convert shrinker API sentinel values to 0 for debugfs output */ + if (count == SHRINK_EMPTY) + count = 0; + if (scanned == SHRINK_STOP) + scanned = 0; + + seq_printf(m, "%d: %lu/%lu\n", nid, count, scanned); } fs_reclaim_release(GFP_KERNEL); |
