From 7641ff0a300a1b4891a18e19cfcf302bef928d30 Mon Sep 17 00:00:00 2001 From: Jindong Yue Date: Fri, 9 Jun 2023 09:24:41 +0800 Subject: [PATCH] ANDROID: mm: Avoid merging cma with others MIGRATE_CMA is incorrectly considered as mergeable since 433445e9a160 ("ANDROID: mm: add cma pcp list"), which moves the MIGRATE_PCPTYPES enum after MIGRATE_CMA. This causes incorrect CMA accounting with CmaFree greater than CmaTotal. CmaTotal: 307200 kB CmaFree: 314100 kB The problem is observed when running the CtsAutoFillServiceTestCases module with mem=2G, cma=300M, swap(zram)=600M. And this issue is caused by the combination of 433445e9a160 ("ANDROID: mm: add cma pcp list") and 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable pageblocks with others") which was introduced in 5.18 kernel. Bug: 282793501 Fixes: 433445e9a160 ("ANDROID: mm: add cma pcp list") Signed-off-by: Haoran.Wang Signed-off-by: Jindong Yue Change-Id: I9bf705984682f29b2a23ba38536e667617b1a8b6 --- include/linux/mmzone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 751d9e77b90e..6f23778a72c5 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -94,7 +94,7 @@ static inline bool is_migrate_movable(int mt) */ static inline bool migratetype_is_mergeable(int mt) { - return mt < MIGRATE_PCPTYPES; + return mt <= MIGRATE_RECLAIMABLE; } #define for_each_migratetype_order(order, type) \