[PATCH v5 16/17] drm/shmem-helper: Make drm_gem_shmem_is_purgeable() private
Dmitry Osipenko
dmitry.osipenko at collabora.com
Sun Apr 24 19:04:23 UTC 2022
Panfrost driver was the only user of the drm_gem_shmem_is_purgeable()
helper. Panfrost driver was converted to use new generic memory shrinker
and the helper doesn't have external users anymore, hence make it private
to the drm_gem_shmem_helper.c to keep the code clean.
Signed-off-by: Dmitry Osipenko <dmitry.osipenko at collabora.com>
---
drivers/gpu/drm/drm_gem_shmem_helper.c | 9 ++++++++-
include/drm/drm_gem_shmem_helper.h | 7 -------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 7ec5f8002f68..045921ad4795 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -169,6 +169,13 @@ static bool drm_gem_shmem_is_evictable(struct drm_gem_shmem_object *shmem)
!shmem->base.import_attach && shmem->sgt && !shmem->evicted;
}
+static bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object *shmem)
+{
+ return (shmem->madv > 0) && !shmem->purge_disable_count &&
+ !shmem->vmap_use_count && !shmem->base.dma_buf &&
+ !shmem->base.import_attach && shmem->sgt;
+}
+
static void
drm_gem_shmem_update_pages_state_locked(struct drm_gem_shmem_object *shmem)
{
@@ -182,7 +189,7 @@ drm_gem_shmem_update_pages_state_locked(struct drm_gem_shmem_object *shmem)
mutex_lock(&gem_shrinker->lock);
- if (drm_gem_shmem_is_purgeable(shmem) && !shmem->purge_disable_count) {
+ if (drm_gem_shmem_is_purgeable(shmem)) {
drm_gem_shmem_add_pages_to_shrinker(shmem);
list_move_tail(&shmem->madv_list, &gem_shrinker->lru_purgeable);
} else if (drm_gem_shmem_is_evictable(shmem)) {
diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h
index 5b351933c293..972687bf9717 100644
--- a/include/drm/drm_gem_shmem_helper.h
+++ b/include/drm/drm_gem_shmem_helper.h
@@ -194,13 +194,6 @@ int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv);
int drm_gem_shmem_set_purgeable(struct drm_gem_shmem_object *shmem);
int drm_gem_shmem_set_purgeable_and_evictable(struct drm_gem_shmem_object *shmem);
-static inline bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object *shmem)
-{
- return (shmem->madv > 0) &&
- !shmem->vmap_use_count && shmem->sgt &&
- !shmem->base.dma_buf && !shmem->base.import_attach;
-}
-
int drm_gem_shmem_swap_in_locked(struct drm_gem_shmem_object *shmem);
void drm_gem_shmem_purge_locked(struct drm_gem_shmem_object *shmem);
--
2.35.1
More information about the dri-devel
mailing list