From e705e671675b12f80956f48ccb51285b7ba673bb Mon Sep 17 00:00:00 2001 From: Zhen Chen Date: Mon, 10 Sep 2018 16:10:43 +0800 Subject: [PATCH] MALI: utgard: RK: use '__GFP_ZERO | GFP_HIGHUSER' as 'flags' of alloc_page() Just the same as in Midgard device driver. This could resolve Defect #170228 and #184427 in RK redmine. In addition, add err log for the case that alloc_page() returns NULL. Change-Id: Ie1ddfae9429236900e4308e2cfecec2cd75a183a Signed-off-by: Zhen Chen --- drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.c b/drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.c index db6d0085c307..a04ce36f8fa6 100755 --- a/drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.c +++ b/drivers/gpu/arm/mali400/mali/linux/mali_memory_os_alloc.c @@ -8,6 +8,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "../platform/rk/custom_log.h" + #include #include #include @@ -200,7 +202,7 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) /* Allocate new pages, if needed. */ for (i = 0; i < remaining; i++) { dma_addr_t dma_addr; - gfp_t flags = __GFP_ZERO | __GFP_REPEAT | __GFP_NOWARN | __GFP_COLD; + gfp_t flags = __GFP_ZERO | GFP_HIGHUSER; int err; #if defined(CONFIG_ARM) && !defined(CONFIG_ARM_LPAE) @@ -210,7 +212,6 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) flags |= GFP_DMA32; #else #ifdef CONFIG_ZONE_DMA - flags |= GFP_DMA; #else /* arm64 utgard only work on < 4G, but the kernel * didn't provide method to allocte memory < 4G @@ -223,6 +224,7 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) new_page = alloc_page(flags); if (unlikely(NULL == new_page)) { + E("err."); /* Calculate the number of pages actually allocated, and free them. */ os_mem->count = (page_count - remaining) + i; atomic_add(os_mem->count, &mali_mem_os_allocator.allocated_pages);