From: Hongfu Li <hongfu.li@linux.dev>
To: christian.koenig@amd.com, ray.huang@amd.com,
matthew.auld@intel.com, matthew.brost@intel.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
syeh@vmware.com, alexander.deucher@amd.com, Hongbo.He@amd.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
hongfu.li@linux.dev, Hongfu Li <lihongfu@kylinos.cn>
Subject: [PATCH v2] drm/ttm: Fix hardcoded LRU index in ttm_device_fini()
Date: Thu, 6 Aug 2026 16:52:03 +0800 [thread overview]
Message-ID: <20260806085203.5268-1-hongfu.li@linux.dev> (raw)
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
reply other threads:[~2026-08-06 8:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260806085203.5268-1-hongfu.li@linux.dev \
--to=hongfu.li@linux.dev \
--cc=Hongbo.He@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lihongfu@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=ray.huang@amd.com \
--cc=simona@ffwll.ch \
--cc=syeh@vmware.com \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.