From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A392441F5FD for ; Thu, 6 Aug 2026 08:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006350; cv=none; b=BogS/B8M5G/Ob17ZXj65bQkQUF9tmoHNvBZanJu8ilSgJTzdhRAyG8RpqvMTZwfvSQqiAsu7emjvXFlF2JWm097x7xf3YelhUANxIu/rDwolhWJbjthYIZzHjnH3EpyMVktGkzsegIPfbk3AJhA1lYfg4uTbB8QXx+FEvo2YcZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006350; c=relaxed/simple; bh=UkQnl0bX5x8wAkHMMfAbZDKEcm5Nr0qsSMqhTeWjkvU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aS7H08Z07XZqPzzV5oan6h70ED/bmFQJWkoduCVjU04SOH1wxMo8wBN/WPKbSq81QLg0L1TTI67IRIOrOxP+m8d6ylmbhx7xAglHzsbxjFjQfryGrl7faDucteB27ALeu/qkZAJ6q0SSgtms3xWKoX/BV9/Jo321TIp36U2xG3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WTYUcXH5; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WTYUcXH5" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786006342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VFLbWVUfMcTF/uRRMOzyFcp+4eS6agFQIGUD7x9RHd8=; b=WTYUcXH5ZSQu5tK8oM9H9x0dmak31UtEVNl3M5o5SgozgjlT6/EZl2Kai2KDQlMuaWmkE7 CBxOuoqGXqgFuXWEhrD+Lu/E6Czfhl4CjjyddCVYrGAtwwnpjHvZldYj0OMvVNWUVkupEY NpnPz66MCeH8sBSWtAqqOyMGrePPsLs= From: Hongfu Li 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 Subject: [PATCH v2] drm/ttm: Fix hardcoded LRU index in ttm_device_fini() Date: Thu, 6 Aug 2026 16:52:03 +0800 Message-ID: <20260806085203.5268-1-hongfu.li@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Hongfu Li 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 --- 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