From 74f247e31bdc94469e44e55837dfb59c3bdda1de Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Mon, 18 Oct 2021 09:11:11 -0700 Subject: [PATCH] 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 Change-Id: I869461bf645fa81bbb3363a210f620e4b5c9bb29 --- mm/cma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/cma.c b/mm/cma.c index 47538607045e..a7638d7487c4 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -42,6 +42,9 @@ #include "cma.h" +extern void lru_cache_disable(void); +extern void lru_cache_enable(void); + struct cma cma_areas[MAX_CMA_AREAS]; 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) goto out; + lru_cache_disable(); for (;;) { 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_info(cma->name, page, count, align, &cma_info);