diff options
author | Ying Han <yinghan@google.com> | 2011-05-24 20:12:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:26 -0400 |
commit | 1495f230fa7750479c79e3656286b9183d662077 (patch) | |
tree | e5e233bb9fe1916ccc7281e7dcc71b1572fb22c5 /drivers | |
parent | a09ed5e00084448453c8bada4dcd31e5fbfc2f21 (diff) |
vmscan: change shrinker API by passing shrink_control struct
Change each shrinker's API by consolidating the existing parameters into
shrink_control struct. This will simplify any further features added w/o
touching each file of shrinker.
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: fix warning]
[kosaki.motohiro@jp.fujitsu.com: fix up new shrinker API]
[akpm@linux-foundation.org: fix xfs warning]
[akpm@linux-foundation.org: update gfs2]
Signed-off-by: Ying Han <yinghan@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_page_alloc.c | 4 | ||||
-rw-r--r-- | drivers/staging/zcache/zcache.c | 5 |
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c6289034e29a..0b2e167d2bce 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -56,9 +56,7 @@ static int i915_gem_phys_pwrite(struct drm_device *dev, | |||
56 | static void i915_gem_free_object_tail(struct drm_i915_gem_object *obj); | 56 | static void i915_gem_free_object_tail(struct drm_i915_gem_object *obj); |
57 | 57 | ||
58 | static int i915_gem_inactive_shrink(struct shrinker *shrinker, | 58 | static int i915_gem_inactive_shrink(struct shrinker *shrinker, |
59 | int nr_to_scan, | 59 | struct shrink_control *sc); |
60 | gfp_t gfp_mask); | ||
61 | |||
62 | 60 | ||
63 | /* some bookkeeping */ | 61 | /* some bookkeeping */ |
64 | static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv, | 62 | static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv, |
@@ -4092,9 +4090,7 @@ i915_gpu_is_active(struct drm_device *dev) | |||
4092 | } | 4090 | } |
4093 | 4091 | ||
4094 | static int | 4092 | static int |
4095 | i915_gem_inactive_shrink(struct shrinker *shrinker, | 4093 | i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc) |
4096 | int nr_to_scan, | ||
4097 | gfp_t gfp_mask) | ||
4098 | { | 4094 | { |
4099 | struct drm_i915_private *dev_priv = | 4095 | struct drm_i915_private *dev_priv = |
4100 | container_of(shrinker, | 4096 | container_of(shrinker, |
@@ -4102,6 +4098,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, | |||
4102 | mm.inactive_shrinker); | 4098 | mm.inactive_shrinker); |
4103 | struct drm_device *dev = dev_priv->dev; | 4099 | struct drm_device *dev = dev_priv->dev; |
4104 | struct drm_i915_gem_object *obj, *next; | 4100 | struct drm_i915_gem_object *obj, *next; |
4101 | int nr_to_scan = sc->nr_to_scan; | ||
4105 | int cnt; | 4102 | int cnt; |
4106 | 4103 | ||
4107 | if (!mutex_trylock(&dev->struct_mutex)) | 4104 | if (!mutex_trylock(&dev->struct_mutex)) |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 9d9d92945f8c..d948575717bf 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c | |||
@@ -395,12 +395,14 @@ static int ttm_pool_get_num_unused_pages(void) | |||
395 | /** | 395 | /** |
396 | * Callback for mm to request pool to reduce number of page held. | 396 | * Callback for mm to request pool to reduce number of page held. |
397 | */ | 397 | */ |
398 | static int ttm_pool_mm_shrink(struct shrinker *shrink, int shrink_pages, gfp_t gfp_mask) | 398 | static int ttm_pool_mm_shrink(struct shrinker *shrink, |
399 | struct shrink_control *sc) | ||
399 | { | 400 | { |
400 | static atomic_t start_pool = ATOMIC_INIT(0); | 401 | static atomic_t start_pool = ATOMIC_INIT(0); |
401 | unsigned i; | 402 | unsigned i; |
402 | unsigned pool_offset = atomic_add_return(1, &start_pool); | 403 | unsigned pool_offset = atomic_add_return(1, &start_pool); |
403 | struct ttm_page_pool *pool; | 404 | struct ttm_page_pool *pool; |
405 | int shrink_pages = sc->nr_to_scan; | ||
404 | 406 | ||
405 | pool_offset = pool_offset % NUM_POOLS; | 407 | pool_offset = pool_offset % NUM_POOLS; |
406 | /* select start pool in round robin fashion */ | 408 | /* select start pool in round robin fashion */ |
diff --git a/drivers/staging/zcache/zcache.c b/drivers/staging/zcache/zcache.c index b8a2b30a1572..77ac2d4d3ef1 100644 --- a/drivers/staging/zcache/zcache.c +++ b/drivers/staging/zcache/zcache.c | |||
@@ -1181,9 +1181,12 @@ static bool zcache_freeze; | |||
1181 | /* | 1181 | /* |
1182 | * zcache shrinker interface (only useful for ephemeral pages, so zbud only) | 1182 | * zcache shrinker interface (only useful for ephemeral pages, so zbud only) |
1183 | */ | 1183 | */ |
1184 | static int shrink_zcache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask) | 1184 | static int shrink_zcache_memory(struct shrinker *shrink, |
1185 | struct shrink_control *sc) | ||
1185 | { | 1186 | { |
1186 | int ret = -1; | 1187 | int ret = -1; |
1188 | int nr = sc->nr_to_scan; | ||
1189 | gfp_t gfp_mask = sc->gfp_mask; | ||
1187 | 1190 | ||
1188 | if (nr >= 0) { | 1191 | if (nr >= 0) { |
1189 | if (!(gfp_mask & __GFP_FS)) | 1192 | if (!(gfp_mask & __GFP_FS)) |