aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/android/ion/ion_page_pool.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-12-12 17:50:35 -0800
committerColin Cross <ccross@android.com>2013-12-19 19:25:39 -0800
commitf3ae9a8286d63f13715d2082965d6b8849af05a5 (patch)
tree27804ab966956f2c36f87660e057068bd1dc514d /drivers/staging/android/ion/ion_page_pool.c
parent892e1580141cde0f80180e43f6c8c3dc356ddaf2 (diff)
ion: move shrinker out of heaps
Every heap that uses deferred frees is going to need a shrinker to shrink the freelist under memory pressure. Rather than requiring each heap to implement a shrinker, automatically register a shrinker if the deferred free flag is set. The system heap also needs to shrink its page pools, so add a shrink function to the heap ops that will be called after shrinking the freelists. Change-Id: Icda722d683426fadb8ddd1c8e9499264ab682c57 Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'drivers/staging/android/ion/ion_page_pool.c')
-rw-r--r--drivers/staging/android/ion/ion_page_pool.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
index f087a02770a..0e20e62ec4b 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -130,15 +130,11 @@ static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
int nr_to_scan)
{
- int nr_freed = 0;
int i;
bool high;
high = !!(gfp_mask & __GFP_HIGHMEM);
- if (nr_to_scan == 0)
- return ion_page_pool_total(pool, high);
-
for (i = 0; i < nr_to_scan; i++) {
struct page *page;
@@ -153,10 +149,9 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
}
mutex_unlock(&pool->mutex);
ion_page_pool_free_pages(pool, page);
- nr_freed += (1 << pool->order);
}
- return nr_freed;
+ return ion_page_pool_total(pool, high);
}
struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned int order)