ion: free low memory from page pools first
authorColin Cross <ccross@android.com>
Fri, 22 Nov 2013 02:56:37 +0000 (18:56 -0800)
committerColin Cross <ccross@android.com>
Thu, 12 Dec 2013 23:27:09 +0000 (15:27 -0800)
When the shrinkers are called with GFP_HIGH free low memory first,
it is more important to have free than high memory.

Change-Id: I7ad8a9c133830f04d429c3d87b781b3e862ccedb
Signed-off-by: Colin Cross <ccross@android.com>
drivers/staging/android/ion/ion_page_pool.c

index b052ff6bf38301e55711a760c02b4d862e58277c..5a0e629c188bc1c6426e2d132d842592d1705b6a 100644 (file)
@@ -143,10 +143,10 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
                struct page *page;
 
                mutex_lock(&pool->mutex);
-               if (high && pool->high_count) {
-                       page = ion_page_pool_remove(pool, true);
-               } else if (pool->low_count) {
+               if (pool->low_count) {
                        page = ion_page_pool_remove(pool, false);
+               } else if (high && pool->high_count) {
+                       page = ion_page_pool_remove(pool, true);
                } else {
                        mutex_unlock(&pool->mutex);
                        break;