From 1848b13f54bddebd646c35307db669cd0052db48 Mon Sep 17 00:00:00 2001 From: "binqi.zhang" Date: Fri, 3 Nov 2017 13:53:14 +0800 Subject: [PATCH] gpu: mali will report GL OOM to hwui when alloc_page fail [1/1] PD# 152678 add GFP_KERNEL flag to alloc_page if alloc_page fail and try alloc again Change-Id: I9bc87ed2e00c9525231eb2aaa3b3971cf0ac8ed8 --- utgard/r7p0/linux/mali_memory_os_alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utgard/r7p0/linux/mali_memory_os_alloc.c b/utgard/r7p0/linux/mali_memory_os_alloc.c index bcd87ec..e789a03 100644 --- a/utgard/r7p0/linux/mali_memory_os_alloc.c +++ b/utgard/r7p0/linux/mali_memory_os_alloc.c @@ -226,10 +226,15 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) new_page = alloc_page(flags); + if (new_page == NULL) { + MALI_PRINT_ERROR(("alloc_page() return NULL! try again!\n")); + new_page = alloc_page(flags | GFP_KERNEL); + } + if (unlikely(new_page == NULL)) { /* Calculate the number of pages actually allocated, and free them. */ + MALI_PRINT_ERROR(("alloc_page() return NULL at last\n")); #ifdef AML_MALI_DEBUG - MALI_PRINT_ERROR(("alloc_page() return NULL\n")); show_mem(SHOW_MEM_FILTER_NODES); #endif os_mem->count = (page_count - remaining) + i; @@ -552,12 +557,12 @@ _mali_osk_errcode_t mali_mem_os_get_table_page(mali_dma_addr *phys, mali_io_addr *phys = (mali_dma_addr)tmp_phys; } } -#ifdef AML_MALI_DEBUG if (ret != _MALI_OSK_ERR_OK) { MALI_PRINT_ERROR(("dma_alloc_attrs() return NULL\n")); +#ifdef AML_MALI_DEBUG show_mem(SHOW_MEM_FILTER_NODES); - } #endif + } return ret; } -- 2.20.1