mm: port lowmemorykiller for 5.15+P. [1/2]
PD#SWPL-124928
Problem:
Android P no LMKD.
Solution:
add statistics for free file cma and more.
Verify:
local.
Change-Id: If31f74666d97b9e42627e7d7fff693b52e0fbc2e
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 37e503d..569c368 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2022,6 +2022,11 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
unsigned long skipped = 0;
unsigned long scan, total_scan, nr_pages;
LIST_HEAD(pages_skipped);
+#ifdef CONFIG_AMLOGIC_LMK
+ int num = NR_INACTIVE_ANON_CMA - NR_ZONE_INACTIVE_ANON +
+ NR_ZONE_LRU_BASE;
+ int migrate_type = 0;
+#endif /* CONFIG_AMLOGIC_LMK */
total_scan = 0;
scan = 0;
@@ -2073,6 +2078,13 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
nr_taken += nr_pages;
nr_zone_taken[page_zonenum(page)] += nr_pages;
move_to = dst;
+ #ifdef CONFIG_AMLOGIC_LMK
+ migrate_type = get_pageblock_migratetype(page);
+ if (is_migrate_cma(migrate_type) ||
+ is_migrate_isolate(migrate_type))
+ __mod_zone_page_state(page_zone(page),
+ lru + num, -nr_pages);
+ #endif /* CONFIG_AMLOGIC_LMK */
move:
list_move(&page->lru, move_to);
}