PD#SWPL-1210
Problem:
Some drivers(eth/wifi) occasionally can't allocate memory under
atomic context. From mem status print, there are enough free
pages but most of them are CMA.
Solution:
Exclude free cma pages when calculate water mark. This can push
kswapd/compaction work more aggressive.
Verify:
P212
Change-Id: Ia723f21c0316eff1a38e759ff9f044bb59aa8efa
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
#ifdef CONFIG_CMA
/* If allocation can't use CMA areas don't use free CMA pages */
+#ifndef CONFIG_AMLOGIC_CMA /* always sub cma pages to avoid wm all CMA */
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
+ free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
#endif
/*