gpu: mali will report GL OOM to hwui when alloc_page fail [1/1]
authorbinqi.zhang <binqi.zhang@amlogic.com>
Fri, 3 Nov 2017 05:53:14 +0000 (13:53 +0800)
committerbinqi.zhang <binqi.zhang@amlogic.com>
Fri, 3 Nov 2017 06:49:18 +0000 (14:49 +0800)
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

index bcd87ecd266656cbc6b5fdb8ba3c2ef19c20b61a..e789a035567d098f75bb3b9d549ace231373b13c 100644 (file)
@@ -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;
 }