summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-12-13 01:10:55 +0800
committerAndy Green <andy.green@linaro.org>2011-12-26 16:35:38 +0800
commit1ebf34427a3067fc9beb0de07d2be947d59d6866 (patch)
tree3c6bb1327f9d811113d6db0d2ae9d68970841ac2 /mm
parent7c0db49bfec381780e906eba576bf3e60b788d3d (diff)
mm: ashmem: Fix arguments to ashmem_shrink
The arguments to shrink functions have changed, update ashmem_shrink to match. Change-Id: Id279d22d761a2a7c4965c957960eef804d06cc07 Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/ashmem.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/mm/ashmem.c b/mm/ashmem.c
index f92eb34a148..66e3f23ee33 100644
--- a/mm/ashmem.c
+++ b/mm/ashmem.c
@@ -347,14 +347,14 @@ out:
* chunks of ashmem regions LRU-wise one-at-a-time until we hit 'nr_to_scan'
* pages freed.
*/
-static int ashmem_shrink(struct shrinker *s, int nr_to_scan, gfp_t gfp_mask)
+static int ashmem_shrink(struct shrinker *s, struct shrink_control *sc)
{
struct ashmem_range *range, *next;
/* We might recurse into filesystem code, so bail out if necessary */
- if (nr_to_scan && !(gfp_mask & __GFP_FS))
+ if (sc->nr_to_scan && !(sc->gfp_mask & __GFP_FS))
return -1;
- if (!nr_to_scan)
+ if (!sc->nr_to_scan)
return lru_count;
mutex_lock(&ashmem_mutex);
@@ -367,8 +367,8 @@ static int ashmem_shrink(struct shrinker *s, int nr_to_scan, gfp_t gfp_mask)
range->purged = ASHMEM_WAS_PURGED;
lru_del(range);
- nr_to_scan -= range_size(range);
- if (nr_to_scan <= 0)
+ sc->nr_to_scan -= range_size(range);
+ if (sc->nr_to_scan <= 0)
break;
}
mutex_unlock(&ashmem_mutex);
@@ -662,8 +662,13 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case ASHMEM_PURGE_ALL_CACHES:
ret = -EPERM;
if (capable(CAP_SYS_ADMIN)) {
- ret = ashmem_shrink(&ashmem_shrinker, 0, GFP_KERNEL);
- ashmem_shrink(&ashmem_shrinker, ret, GFP_KERNEL);
+ struct shrink_control sc = {
+ .gfp_mask = GFP_KERNEL,
+ .nr_to_scan = 0,
+ };
+ ret = ashmem_shrink(&ashmem_shrinker, &sc);
+ sc.nr_to_scan = ret;
+ ashmem_shrink(&ashmem_shrinker, &sc);
}
break;
}