mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-23 15:26:50 -04:00
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>
This commit is contained in:
committed by
Mario Limonciello
parent
723a2a698f
commit
811a8d6f2c
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user