From 3185c2d09654c80e0fbad36674afdbd78c999334 Mon Sep 17 00:00:00 2001 From: Martin Liu Date: Tue, 2 Jun 2020 13:05:51 +0800 Subject: [PATCH] lmkd: Fix do not kill perceptible apps due to low swap if above min wmark Fix code logic to obey our intetion of not killing perceptible apps due to low swap if above min wmark. Bug: 155709603 Test: boot Signed-off-by: Martin Liu Merged-In: Ifc09c2a1fe7e21faa096988f471644f63951d81c Change-Id: Ifc09c2a1fe7e21faa096988f471644f63951d81c --- lmkd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lmkd.cpp b/lmkd.cpp index 8cef9f1..2e0e6f7 100644 --- a/lmkd.cpp +++ b/lmkd.cpp @@ -2397,7 +2397,7 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_ "kB < %" PRId64 "kB) and thrashing (%" PRId64 "%%)", mi.field.free_swap * page_k, swap_low_threshold * page_k, thrashing); /* Do not kill perceptible apps unless below min watermark */ - if (wmark < WMARK_LOW) { + if (wmark > WMARK_MIN) { min_score_adj = PERCEPTIBLE_APP_ADJ + 1; } } else if (swap_is_low && wmark < WMARK_HIGH) { @@ -2407,7 +2407,7 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_ PRId64 "kB < %" PRId64 "kB)", wmark > WMARK_LOW ? "min" : "low", mi.field.free_swap * page_k, swap_low_threshold * page_k); /* Do not kill perceptible apps unless below min watermark */ - if (wmark < WMARK_LOW) { + if (wmark > WMARK_MIN) { min_score_adj = PERCEPTIBLE_APP_ADJ + 1; } } else if (wmark < WMARK_HIGH && swap_util_max < 100 &&