The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] drm/ttm: Fix hardcoded LRU index in ttm_device_fini()
@ 2026-08-06  8:52 Hongfu Li
  0 siblings, 0 replies; only message in thread
From: Hongfu Li @ 2026-08-06  8:52 UTC (permalink / raw)
  To: christian.koenig, ray.huang, matthew.auld, matthew.brost,
	maarten.lankhorst, mripard, tzimmermann, airlied, simona, syeh,
	alexander.deucher, Hongbo.He
  Cc: dri-devel, linux-kernel, hongfu.li, Hongfu Li

From: Hongfu Li <lihongfu@kylinos.cn>

When iterating all TTM_MAX_BO_PRIORITY LRU lists using loop variable i,
the list_empty() check references man->lru[0] instead of man->lru[i].
The loop therefore relies entirely on the state of priority 0 LRU
rather than checking each priority list individually.

Change hardcoded index man->lru[0] to man->lru[i] to correctly
inspect every per-priority LRU list.

Fixes: cf6c467d67d3 ("drm/ttm: add BO priorities for the LRUs")
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
v2:
- Only the commit message was updated, including the Fixes: tag; no code
  changes.
- Link to v1: https://lore.kernel.org/all/20260715085823.25671-1-hongfu.li@linux.dev/
---
 drivers/gpu/drm/ttm/ttm_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index d3bfb9a696a7..e22c77f4228e 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -266,7 +266,7 @@ void ttm_device_fini(struct ttm_device *bdev)
 
 	spin_lock(&bdev->lru_lock);
 	for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i)
-		if (list_empty(&man->lru[0]))
+		if (list_empty(&man->lru[i]))
 			pr_debug("Swap list %d was clean\n", i);
 	spin_unlock(&bdev->lru_lock);
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-06  8:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06  8:52 [PATCH v2] drm/ttm: Fix hardcoded LRU index in ttm_device_fini() Hongfu Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox