From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
jonathan.cavitt@intel.com, thomas.hellstrom@linux.intel.com,
maarten.lankhorst@linux.intel.com, matthew.brost@intel.com
Subject: [PATCH v2] drm/pagemap_util: Ensure proper cache lock management on free
Date: Tue, 24 Feb 2026 15:48:33 +0000 [thread overview]
Message-ID: <20260224154832.7249-2-jonathan.cavitt@intel.com> (raw)
Static analysis issue:
Though probably unnecessary given the cache is being freed at this step,
for the sake of consistency, ensure that the cache lock is always
unlocked after drm_pagemap_cache_fini.
v2:
- Use requested code flow (Maarten)
Fixes: 77f14f2f2d73f ("drm/pagemap: Add a drm_pagemap cache and shrinker")
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/drm_pagemap_util.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_pagemap_util.c b/drivers/gpu/drm/drm_pagemap_util.c
index 14ddb948a32e..66203a19f8f6 100644
--- a/drivers/gpu/drm/drm_pagemap_util.c
+++ b/drivers/gpu/drm/drm_pagemap_util.c
@@ -65,18 +65,13 @@ static void drm_pagemap_cache_fini(void *arg)
drm_dbg(cache->shrinker->drm, "Destroying dpagemap cache.\n");
spin_lock(&cache->lock);
dpagemap = cache->dpagemap;
- if (!dpagemap) {
- spin_unlock(&cache->lock);
- goto out;
- }
+ if (dpagemap && !drm_pagemap_shrinker_cancel(dpagemap))
+ dpagemap = NULL;
+ spin_unlock(&cache->lock);
- if (drm_pagemap_shrinker_cancel(dpagemap)) {
- cache->dpagemap = NULL;
- spin_unlock(&cache->lock);
+ if (dpagemap)
drm_pagemap_destroy(dpagemap, false);
- }
-out:
mutex_destroy(&cache->lookup_mutex);
kfree(cache);
}
--
2.43.0
next reply other threads:[~2026-02-24 15:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 15:48 Jonathan Cavitt [this message]
2026-02-24 23:11 ` [PATCH v2] drm/pagemap_util: Ensure proper cache lock management on free Matthew Brost
2026-02-24 23:15 ` Cavitt, Jonathan
2026-02-27 5:07 ` Claude review: " Claude Code Review Bot
2026-02-27 5:07 ` 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=20260224154832.7249-2-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=saurabhg.gupta@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
/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