From 660103696cc7f753e0da97cb1488b5246cc016e9 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Thu, 22 Feb 2018 23:22:24 +0900 Subject: [PATCH] [COMMON] android: ion: fix overwriting gfp flags 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 --- drivers/staging/android/ion/ion_system_heap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index e754f9351d86..09ae4bca428e 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -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) -- 2.20.1