ANDROID: mm: cma: disable LRU cache early

CMA is supposed to work with multiple retrial in case of seeing
-EBUSY. During the trials, it's not desirable to enable LRU
pagevec caching because it needs to keep LRU draining in
alloc_contig_range API, which is expensive when CPUs are busy.

Bug: 196012565
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I869461bf645fa81bbb3363a210f620e4b5c9bb29
This commit is contained in:
Minchan Kim
2021-10-18 09:11:11 -07:00
parent 496b17304a
commit 74f247e31b

View File

@@ -42,6 +42,9 @@
#include "cma.h" #include "cma.h"
extern void lru_cache_disable(void);
extern void lru_cache_enable(void);
struct cma cma_areas[MAX_CMA_AREAS]; struct cma cma_areas[MAX_CMA_AREAS];
unsigned cma_area_count; unsigned cma_area_count;
@@ -466,6 +469,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
if (bitmap_count > bitmap_maxno) if (bitmap_count > bitmap_maxno)
goto out; goto out;
lru_cache_disable();
for (;;) { for (;;) {
struct acr_info info = {0}; struct acr_info info = {0};
@@ -545,6 +549,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
} }
} }
lru_cache_enable();
trace_cma_alloc_finish(cma->name, pfn, page, count, align); trace_cma_alloc_finish(cma->name, pfn, page, count, align);
trace_cma_alloc_info(cma->name, page, count, align, &cma_info); trace_cma_alloc_info(cma->name, page, count, align, &cma_info);