@@ -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)) {
@@ -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);
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@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(-)