[PATCH v2] ION: Sys_heap: fix the incorrect pool->gfp_mask setting

Zeng Tao prime.zeng at hisilicon.com
Thu Jan 18 16:37:06 UTC 2018


The gfp_mask low order pool is overlapped by the high order
inside the loop, so the gfp_mask of all pools are set to
high_order_gfp_flags. And all the allcations will have no __GFP_RECLAIM
flag, we will easily get the allocation failure problem with
memory presure.

Changes since v1:
1. fix the tag
2. change the flags define based on the comment.

Fixes: e7f63771b60e ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")
Signed-off-by: Zeng Tao <prime.zeng at hisilicon.com>
---
 drivers/staging/android/ion/ion_system_heap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
index 4dc5d7a..12d0801 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -305,6 +305,8 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools,
 
 		if (orders[i] > 4)
 			gfp_flags = high_order_gfp_flags;
+		else
+			gfp_flags = low_order_gfp_flags;
 
 		pool = ion_page_pool_create(gfp_flags, orders[i], cached);
 		if (!pool)
-- 
2.7.4



More information about the devel mailing list