diff options
| author | Laura Abbott <lauraa@codeaurora.org> | 2014-08-07 15:14:22 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:04:05 -0700 |
| commit | a9b26544eeb99375aa62b07eb871e40e7acabac4 (patch) | |
| tree | fd07f25dfd95e081e7fa3e562161dc796273f15e | |
| parent | 44e7c990811d91a1b62f60005585a074d1183c9d (diff) | |
ion: Switch to new shrinker interface
The shrinker interface has now changed with separate count and scan
functions. Update this for the secure CMA shrinker.
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
| -rw-r--r-- | drivers/staging/android/ion/ion_cma_secure_heap.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/staging/android/ion/ion_cma_secure_heap.c b/drivers/staging/android/ion/ion_cma_secure_heap.c index c7eca7c68b09..f0723dd0a3b1 100644 --- a/drivers/staging/android/ion/ion_cma_secure_heap.c +++ b/drivers/staging/android/ion/ion_cma_secure_heap.c @@ -371,16 +371,13 @@ int ion_secure_cma_drain_pool(struct ion_heap *heap, void *unused) return 0; } -static int ion_secure_cma_shrinker(struct shrinker *shrinker, +static unsigned long ion_secure_cma_shrinker(struct shrinker *shrinker, struct shrink_control *sc) { struct ion_cma_secure_heap *sheap = container_of(shrinker, struct ion_cma_secure_heap, shrinker); int nr_to_scan = sc->nr_to_scan; - if (nr_to_scan == 0) - return atomic_read(&sheap->total_pool_size); - /* * Allocation path may invoke the shrinker. Proceeding any further * would cause a deadlock in several places so don't shrink if that @@ -396,6 +393,14 @@ static int ion_secure_cma_shrinker(struct shrinker *shrinker, return atomic_read(&sheap->total_pool_size); } +static unsigned long ion_secure_cma_shrinker_count(struct shrinker *shrinker, + struct shrink_control *sc) +{ + struct ion_cma_secure_heap *sheap = container_of(shrinker, + struct ion_cma_secure_heap, shrinker); + return atomic_read(&sheap->total_pool_size); +} + static void ion_secure_cma_free_from_pool(struct ion_cma_secure_heap *sheap, dma_addr_t handle, unsigned long len) @@ -692,7 +697,8 @@ struct ion_heap *ion_secure_cma_heap_create(struct ion_platform_heap *data) INIT_WORK(&sheap->work, ion_secure_pool_pages); sheap->shrinker.seeks = DEFAULT_SEEKS; sheap->shrinker.batch = 0; -/* sheap->shrinker.shrink = ion_secure_cma_shrinker; */ + sheap->shrinker.scan_objects = ion_secure_cma_shrinker; + sheap->shrinker.count_objects = ion_secure_cma_shrinker_count; sheap->default_prefetch_size = sheap->heap_size; register_shrinker(&sheap->shrinker); |
