ANDROID: mm: Avoid merging cma with others

MIGRATE_CMA is incorrectly considered as mergeable since
433445e9a1 ("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
433445e9a1 ("ANDROID: mm: add cma pcp list") and
1dd214b8f2 ("mm: page_alloc: avoid merging non-fallbackable pageblocks
with others") which was introduced in 5.18 kernel.

Bug: 282793501
Fixes: 433445e9a1 ("ANDROID: mm: add cma pcp list")
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I9bf705984682f29b2a23ba38536e667617b1a8b6
This commit is contained in:
Jindong Yue 2023-06-09 09:24:41 +08:00
parent 9b16d612bf
commit 7641ff0a30

View file

@ -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) \