mm: reduce watermark if free cma is too large [1/1]
authortao zeng <tao.zeng@amlogic.com>
Fri, 26 Oct 2018 09:51:30 +0000 (17:51 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 30 Oct 2018 03:07:51 +0000 (20:07 -0700)
PD#SWPL-807

Problem:
Sometimes driver can't allocation memory under atomic environment.
And free pages is enough but they are nearly ALL CMA pages.

Solution:
Reduce watermark with harf of free cma pages even allocation support
CMA.

Verify:
P212

Change-Id: I8e49768d4384ed064775537754a2b7f09a5bbb7c
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
mm/page_alloc.c

index e79dba9..0862dcf 100644 (file)
@@ -2998,6 +2998,11 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
        /* If allocation can't use CMA areas don't use free CMA pages */
        if (!(alloc_flags & ALLOC_CMA))
                free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
+#ifdef CONFIG_AMLOGIC_CMA
+       /* avoid free pages in water mark are all CMA */
+       else
+               free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES) / 2;
+#endif
 #endif
 
        /*