[COMMON] android: ion: fix overwriting gfp flags
authorCho KyongHo <pullip.cho@samsung.com>
Thu, 22 Feb 2018 14:22:24 +0000 (23:22 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:22 +0000 (19:45 +0900)
The following commit by Chen Feng introduces cached page pools to
improve the allocation perfromance of system heap types.
'commit e7f63771b60e ("ION: Sys_heap: Add cached pool to spead up
 cached buffer alloc")'

But it has a logical problem assigning gfp mask for page allocation
from the kernel page allocator. low_order_gfp_flags should be applied
to the low order page allocations but is is actually not because
high_order_gfp_flags overwrites the gfp_flags at the first iteration
of page pool creation and there is no chance to get back to
low_order_gfp_flags.

Change-Id: I4fb10bfc9f517e660e2f78661d67146380441ecb
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/staging/android/ion/ion_system_heap.c

index e754f9351d86539984334d94a18313aa253199ad..09ae4bca428e946e339b6a9c480ef584953e6ae2 100644 (file)
@@ -298,13 +298,13 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools,
                                        bool cached)
 {
        int i;
-       gfp_t gfp_flags = low_order_gfp_flags;
+       gfp_t gfp_flags = high_order_gfp_flags;
 
        for (i = 0; i < NUM_ORDERS; i++) {
                struct ion_page_pool *pool;
 
-               if (orders[i] > 4)
-                       gfp_flags = high_order_gfp_flags;
+               if (orders[i] < 4)
+                       gfp_flags = low_order_gfp_flags;
 
                pool = ion_page_pool_create(gfp_flags, orders[i], cached);
                if (!pool)