ANDROID: mm: vmscan: support equal reclaim for anon and file pages

When performing memory reclaim, support treating anonymous and
file backed pages equally. Swapping anonymous pages out to memory
can be efficient enough to justify treating anonymous and file backed
pages equally.
Create a vendor hook inside of get_scan_count so that equal reclaim of
anon and file pages can be enabled inside of the trace hook based on
certain conditions.

Bug: 175415908
Change-Id: Idac2f1468371549d20dd3e5652c7382dc3d7d9cf
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Tento commit je obsažen v:
Sudarshan Rajagopalan
2021-06-01 04:05:01 -07:00
odevzdal Suren Baghdasaryan
rodič 4a819fbf90
revize 2699fa478d
3 změnil soubory, kde provedl 11 přidání a 2 odebrání

Zobrazit soubor

@@ -2272,6 +2272,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
enum scan_balance scan_balance;
unsigned long ap, fp;
enum lru_list lru;
bool balance_anon_file_reclaim = false;
/* If we have no swap space, do not bother scanning anon pages. */
if (!sc->may_swap || mem_cgroup_get_nr_swap_pages(memcg) <= 0) {
@@ -2310,11 +2311,15 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
goto out;
}
trace_android_rvh_set_balance_anon_file_reclaim(&balance_anon_file_reclaim);
/*
* If there is enough inactive page cache, we do not reclaim
* anything from the anonymous working right now.
* anything from the anonymous working right now. But when balancing
* anon and page cache files for reclaim, allow swapping of anon pages
* even if there are a number of inactive file cache pages.
*/
if (sc->cache_trim_mode) {
if (!balance_anon_file_reclaim && sc->cache_trim_mode) {
scan_balance = SCAN_FILE;
goto out;
}