staging: ion: shrink page-pool by page unit
authorGioh Kim <gioh.kim@lge.com>
Mon, 6 Jul 2015 06:14:40 +0000 (15:14 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jul 2015 05:47:30 +0000 (22:47 -0700)
commitb44d9ce3b81715311198f0c5fa329e518b4f9f18
treea56a44c4c88b754dd66f067d2465ce6d49da116f
parent3e3148c51190d680b7cc2ebdc556e6ea27a93989
staging: ion: shrink page-pool by page unit

This patch shrink page-pool by page unit.

The system shrinker calls ion_heap_shrink_count() to get nr_to_scan,
and pass it to ion_heap_shrink_scan().
The problem is the return value of ion_heap_shrink_count() is the number
of pages but ion_system_heap_shrink(), which is called by
ion_heap_shrink_scan(), gets the number of chunk.

The main root of this is that ion_page_pool_shrink() returns page count
via ion_page_pool_total() if it have to check pool size. But it frees
chunks of pages if it have to free pools.

This patch first fix ion_page_pool_shrink() to count only pages,
not chunks. And then ion_system_heap_shrink() to work on pages.

Signed-off-by: Gioh Kim <gioh.kim@lge.com>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_page_pool.c
drivers/staging/android/ion/ion_system_heap.c