On 4/27/26 11:22, Mario Limonciello wrote:
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 <[email protected]>
---
  drivers/gpu/drm/ttm/ttm_pool.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)

ping?

diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index 26a3689e5fd90..4e83f4978b136 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -1335,15 +1335,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);

Reply via email to