From: Rob Clark <robin.clark@oss.qualcomm.com>
To: dri-devel@lists.freedesktop.org
Cc: Rob Clark <robin.clark@oss.qualcomm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Boris Brezillon <boris.brezillon@collabora.com>,
Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
linux-kernel@vger.kernel.org (open list),
linux-arm-msm@vger.kernel.org (open list:DRM DRIVER for Qualcomm
display hardware),
freedreno@lists.freedesktop.org (open list:DRM DRIVER for
Qualcomm display hardware)
Subject: [PATCH] drm/gem: Drop ticket arg to lru_scan()
Date: Mon, 31 Aug 2026 10:44:08 -0700 [thread overview]
Message-ID: <20260831174409.465181-1-robin.clark@oss.qualcomm.com> (raw)
Commit 3392291fc509 ("drm/msm: Fix shrinker deadlock") dropped the only
use of the ticket arg, but at the time left drm_gem_lru_scan() unchanged
to avoid conflicts with in-flight pathor shrinker support. This commit
is the followup to remove the unused arg.
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
---
drivers/gpu/drm/drm_gem.c | 13 +++----------
drivers/gpu/drm/msm/msm_gem_shrinker.c | 22 ++++++++++------------
drivers/gpu/drm/panthor/panthor_gem.c | 14 ++++++--------
drivers/gpu/drm/panthor/panthor_mmu.c | 5 ++---
drivers/gpu/drm/panthor/panthor_mmu.h | 3 +--
include/drm/drm_gem.h | 3 +--
6 files changed, 23 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index e3ed684ddcf2..15acb958ecd5 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -1656,8 +1656,7 @@ drm_gem_lru_scan(struct drm_device *dev,
struct drm_gem_lru *lru,
unsigned int nr_to_scan,
unsigned long *remaining,
- bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket),
- struct ww_acquire_ctx *ticket)
+ bool (*shrink)(struct drm_gem_object *obj))
{
struct drm_gem_lru still_in_lru;
struct drm_gem_object *obj;
@@ -1690,20 +1689,17 @@ drm_gem_lru_scan(struct drm_device *dev,
*/
mutex_unlock(&dev->gem_lru_mutex);
- if (ticket)
- ww_acquire_init(ticket, &reservation_ww_class);
-
/*
* Note that this still needs to be trylock, since we can
* hit shrinker in response to trying to get backing pages
* for this obj (ie. while it's lock is already held)
*/
- if (!ww_mutex_trylock(&obj->resv->lock, ticket)) {
+ if (!ww_mutex_trylock(&obj->resv->lock, NULL)) {
*remaining += obj->size >> PAGE_SHIFT;
goto tail;
}
- if (shrink(obj, ticket)) {
+ if (shrink(obj)) {
freed += obj->size >> PAGE_SHIFT;
/*
@@ -1727,9 +1723,6 @@ drm_gem_lru_scan(struct drm_device *dev,
dma_resv_unlock(obj->resv);
- if (ticket)
- ww_acquire_fini(ticket);
-
tail:
drm_gem_object_put(obj);
mutex_lock(&dev->gem_lru_mutex);
diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c
index 9d2788f79ace..3514d5c84989 100644
--- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
+++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
@@ -102,7 +102,7 @@ with_vm_locks(void (*fn)(struct drm_gem_object *obj),
}
static bool
-purge(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
+purge(struct drm_gem_object *obj)
{
if (!is_purgeable(to_msm_bo(obj)))
return false;
@@ -114,7 +114,7 @@ purge(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
}
static bool
-evict(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
+evict(struct drm_gem_object *obj)
{
if (is_unevictable(to_msm_bo(obj)))
return false;
@@ -133,21 +133,21 @@ wait_for_idle(struct drm_gem_object *obj)
}
static bool
-active_purge(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
+active_purge(struct drm_gem_object *obj)
{
if (!wait_for_idle(obj))
return false;
- return purge(obj, ticket);
+ return purge(obj);
}
static bool
-active_evict(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
+active_evict(struct drm_gem_object *obj)
{
if (!wait_for_idle(obj))
return false;
- return evict(obj, ticket);
+ return evict(obj);
}
static unsigned long
@@ -156,7 +156,7 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
struct msm_drm_private *priv = shrinker->private_data;
struct {
struct drm_gem_lru *lru;
- bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket);
+ bool (*shrink)(struct drm_gem_object *obj);
bool cond;
unsigned long freed;
unsigned long remaining;
@@ -180,8 +180,7 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
stages[i].freed =
drm_gem_lru_scan(priv->dev, stages[i].lru, nr,
&stages[i].remaining,
- stages[i].shrink,
- NULL);
+ stages[i].shrink);
nr -= stages[i].freed;
freed += stages[i].freed;
remaining += stages[i].remaining;
@@ -222,7 +221,7 @@ msm_gem_shrinker_shrink(struct drm_device *dev, unsigned long nr_to_scan)
static const int vmap_shrink_limit = 15;
static bool
-vmap_shrink(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
+vmap_shrink(struct drm_gem_object *obj)
{
if (!is_vunmapable(to_msm_bo(obj)))
return false;
@@ -250,8 +249,7 @@ msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr)
unmapped += drm_gem_lru_scan(priv->dev, lrus[idx],
vmap_shrink_limit - unmapped,
&remaining,
- vmap_shrink,
- NULL);
+ vmap_shrink);
}
*(unsigned long *)ptr += unmapped;
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index 54535bae2b0c..17408f832af3 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -1392,8 +1392,7 @@ panthor_gem_shrinker_count(struct shrinker *shrinker, struct shrink_control *sc)
return count ? count : SHRINK_EMPTY;
}
-static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj,
- struct ww_acquire_ctx *ticket)
+static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj)
{
/*
* Track last locked entry for unwinding locks in error and
@@ -1479,8 +1478,7 @@ static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj,
return ret == 0;
}
-static bool panthor_gem_try_evict(struct drm_gem_object *obj,
- struct ww_acquire_ctx *ticket)
+static bool panthor_gem_try_evict(struct drm_gem_object *obj)
{
struct panthor_gem_object *bo = to_panthor_bo(obj);
@@ -1488,7 +1486,7 @@ static bool panthor_gem_try_evict(struct drm_gem_object *obj,
if (dma_resv_wait_timeout(obj->resv, DMA_RESV_USAGE_BOOKKEEP, false, 10) <= 0)
return false;
- return panthor_gem_try_evict_no_resv_wait(&bo->base, ticket);
+ return panthor_gem_try_evict_no_resv_wait(&bo->base);
}
static unsigned long
@@ -1503,13 +1501,13 @@ panthor_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.unused,
sc->nr_to_scan - freed, &remaining,
- panthor_gem_try_evict_no_resv_wait, NULL);
+ panthor_gem_try_evict_no_resv_wait);
if (freed >= sc->nr_to_scan)
goto out;
freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.mmapped,
sc->nr_to_scan - freed, &remaining,
- panthor_gem_try_evict_no_resv_wait, NULL);
+ panthor_gem_try_evict_no_resv_wait);
if (freed >= sc->nr_to_scan)
goto out;
@@ -1523,7 +1521,7 @@ panthor_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.gpu_mapped_shared,
sc->nr_to_scan - freed, &remaining,
- panthor_gem_try_evict, NULL);
+ panthor_gem_try_evict);
out:
#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index e10dbd18d8cf..ab070bc74857 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -3133,8 +3133,7 @@ int panthor_vm_prepare_mapped_bos_resvs(struct drm_exec *exec, struct panthor_vm
unsigned long
panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
unsigned int nr_to_scan, unsigned long *remaining,
- bool (*shrink)(struct drm_gem_object *,
- struct ww_acquire_ctx *))
+ bool (*shrink)(struct drm_gem_object *))
{
unsigned long freed = 0;
LIST_HEAD(remaining_vms);
@@ -3160,7 +3159,7 @@ panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
freed += drm_gem_lru_scan(&ptdev->base, &vm->reclaim.lru,
nr_to_scan - freed,
- remaining, shrink, NULL);
+ remaining, shrink);
mutex_lock(&ptdev->base.gem_lru_mutex);
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.h b/drivers/gpu/drm/panthor/panthor_mmu.h
index 3522fbbce369..abc36e7204be 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.h
+++ b/drivers/gpu/drm/panthor/panthor_mmu.h
@@ -52,8 +52,7 @@ int panthor_vm_evict_bo_mappings_locked(struct panthor_gem_object *bo);
unsigned long
panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
unsigned int nr_to_scan, unsigned long *remaining,
- bool (*shrink)(struct drm_gem_object *,
- struct ww_acquire_ctx *));
+ bool (*shrink)(struct drm_gem_object *));
int panthor_vm_prepare_mapped_bos_resvs(struct drm_exec *exec,
struct panthor_vm *vm,
u32 slot_count);
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 8a704f6a65c1..ffa607c91aa2 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -616,8 +616,7 @@ drm_gem_lru_scan(struct drm_device *dev,
struct drm_gem_lru *lru,
unsigned int nr_to_scan,
unsigned long *remaining,
- bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket),
- struct ww_acquire_ctx *ticket);
+ bool (*shrink)(struct drm_gem_object *obj));
int drm_gem_evict_locked(struct drm_gem_object *obj);
--
2.55.0
next reply other threads:[~2026-08-31 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 17:44 Rob Clark [this message]
2026-09-01 7:26 ` Boris Brezillon
2026-09-01 16:31 ` Liviu Dudau
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=20260831174409.465181-1-robin.clark@oss.qualcomm.com \
--to=robin.clark@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®