From: Mario Limonciello <mario.limonciello@amd.com>
To: Christian König <christian.koenig@amd.com>
Cc: <dri-devel@lists.freedesktop.org>,
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH] ttm/pool: Use sentinels in debugfs
Date: Mon, 27 Apr 2026 11:22:53 -0500 [thread overview]
Message-ID: <20260427162253.682415-1-mario.limonciello@amd.com> (raw)
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>
---
drivers/gpu/drm/ttm/ttm_pool.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
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);
--
2.43.0
next reply other threads:[~2026-04-27 16:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 16:22 Mario Limonciello [this message]
2026-04-28 4:24 ` Claude review: ttm/pool: Use sentinels in debugfs Claude Code Review Bot
2026-04-28 4:24 ` Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260427162253.682415-1-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox