[Devel] [PATCH rh7] drm/backport: drop shrinker legacy shrinker support

Vladimir Davydov vdavydov at virtuozzo.com
Mon Dec 21 07:31:52 PST 2015


In order to avoid pulling the new shrinker API, RH team introduced a
wrapper around the legacy shrinker, which provides the new shrinker API
by calling legacy shrinker functions. Since we already backported new
shrinker API anyway, we don't need this stuff.

This is a fix for 42cf44b4bcd5 ("ms/drivers: convert shrinkers to new
count/scan API").

https://jira.sw.ru/browse/PSBM-42317

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 drivers/gpu/drm/drm_backport.c | 34 ---------------------------
 include/drm/drm_backport.h     | 52 ------------------------------------------
 2 files changed, 86 deletions(-)

diff --git a/drivers/gpu/drm/drm_backport.c b/drivers/gpu/drm/drm_backport.c
index 363476a297d9..489704c6dd1f 100644
--- a/drivers/gpu/drm/drm_backport.c
+++ b/drivers/gpu/drm/drm_backport.c
@@ -8,40 +8,6 @@
 
 #include <drm/drm_backport.h>
 
-/*
- * shrinker
- */
-
-#undef shrinker
-#undef register_shrinker
-#undef unregister_shrinker
-
-static int shrinker2_shrink(struct shrinker *shrinker, struct shrink_control *sc)
-{
-	struct shrinker2 *s2 = container_of(shrinker, struct shrinker2, compat);
-	int count;
-
-	s2->scan_objects(s2, sc);
-	count = s2->count_objects(s2, sc);
-	shrinker->seeks = s2->seeks;
-
-	return count;
-}
-
-void register_shrinker2(struct shrinker2 *s2)
-{
-	s2->compat.shrink = shrinker2_shrink;
-	s2->compat.seeks = s2->seeks;
-	register_shrinker(&s2->compat);
-}
-EXPORT_SYMBOL(register_shrinker2);
-
-void unregister_shrinker2(struct shrinker2 *s2)
-{
-	unregister_shrinker(&s2->compat);
-}
-EXPORT_SYMBOL(unregister_shrinker2);
-
 struct workqueue_struct *system_power_efficient_wq __read_mostly;
 EXPORT_SYMBOL_GPL(system_power_efficient_wq);
 
diff --git a/include/drm/drm_backport.h b/include/drm/drm_backport.h
index 9d354a57b1b4..a5209af79409 100644
--- a/include/drm/drm_backport.h
+++ b/include/drm/drm_backport.h
@@ -49,58 +49,6 @@ static inline ktime_t ktime_mono_to_real(ktime_t mono)
  *
  */
 
-#include <linux/mm.h>
-
-#define SHRINK_STOP (~0UL)
-/*
- * A callback you can register to apply pressure to ageable caches.
- *
- * @count_objects should return the number of freeable items in the cache. If
- * there are no objects to free or the number of freeable items cannot be
- * determined, it should return 0. No deadlock checks should be done during the
- * count callback - the shrinker relies on aggregating scan counts that couldn't
- * be executed due to potential deadlocks to be run at a later call when the
- * deadlock condition is no longer pending.
- *
- * @scan_objects will only be called if @count_objects returned a non-zero
- * value for the number of freeable objects. The callout should scan the cache
- * and attempt to free items from the cache. It should then return the number
- * of objects freed during the scan, or SHRINK_STOP if progress cannot be made
- * due to potential deadlocks. If SHRINK_STOP is returned, then no further
- * attempts to call the @scan_objects will be made from the current reclaim
- * context.
- *
- * @flags determine the shrinker abilities, like numa awareness
- */
-struct shrinker2 {
-	unsigned long (*count_objects)(struct shrinker2 *,
-				       struct shrink_control *sc);
-	unsigned long (*scan_objects)(struct shrinker2 *,
-				      struct shrink_control *sc);
-
-	int seeks;	/* seeks to recreate an obj */
-	long batch;	/* reclaim batch size, 0 = default */
-	unsigned long flags;
-
-	/* These are for internal use */
-	struct list_head list;
-	/* objs pending delete, per node */
-	atomic_long_t *nr_deferred;
-
-	/* compat: */
-	struct shrinker compat;
-};
-void register_shrinker2(struct shrinker2 *shrinker);
-void unregister_shrinker2(struct shrinker2 *shrinker);
-
-#define shrinker            shrinker2
-#define register_shrinker   register_shrinker2
-#define unregister_shrinker unregister_shrinker2
-
-/*
- *
- */
-
 extern struct workqueue_struct *system_power_efficient_wq;
 
 
-- 
2.1.4



More information about the Devel mailing list