ttm/pool: Use sentinels in debugfs
Subsystems (3)
PATCH 1/1 ttm/pool: Use sentinels in debugfs
The values in the page_pool_shrink debugfs file should recognize the sentinels rather than causing an underflow.
Signed-off-by Mario Limonciello <[email protected]>
--- drivers/gpu/drm/ttm/ttm_pool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +10 -3
@@ -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 );
Signature · 1 line
2.43.0
Quoted 9 lines · Mario Limonciello
The values in the
page_pool_shrinkdebugfs file should recognize the sentinels rather than causing an underflow.Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/ttm/ttm_pool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
ping?
Quoted 30 lines
drivers/gpu/drm/ttm/ttm_pool.c +10
-3@@ -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 );
Tvrtko Ursulin
Reviewed-byQuoted 6 lines · Mario Limonciello
Quoted 3 lines · Mario Limonciello
The values in the
page_pool_shrinkdebugfs file should recognize the sentinels rather than causing an underflow.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Mario Limonciello <[email protected]>---
drivers/gpu/drm/ttm/ttm_pool.c| 13 ++++++++++---1 file changed, 10 insertions(+), 3 deletions(-)ping?
LGTM.
Reviewed-by Tvrtko Ursulin <[email protected]>
Regards,
Tvrtko
Quoted 31 lines
Quoted 30 lines
drivers/gpu/drm/ttm/ttm_pool.c +4
-3@@ -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 debugfsoutput */
+ 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);