aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-19 13:16:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-19 13:16:28 +0000
commit1b1b088c40eb66622b16b0453a91aae7dbe467cf (patch)
tree93796623969c48bc3ea3d7791caa9b2e1d59a139
parent499cc71e2838c53a26baec35eae1bd7cb7ed2200 (diff)
parent6a5846e8e20b88ab9a965dc523bd7605d469b609 (diff)
downloadlmkd-android14-d2-s4-release.tar.gz
Change-Id: I68331e6c586147cbe36520a52c6acd7f933c2fde
-rw-r--r--lmkd.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lmkd.cpp b/lmkd.cpp
index fcb06fe..f47982c 100644
--- a/lmkd.cpp
+++ b/lmkd.cpp
@@ -94,6 +94,7 @@ static inline void trace_kill_end() {}
#define LINE_MAX 128
#define PERCEPTIBLE_APP_ADJ 200
+#define PREVIOUS_APP_ADJ 700
/* Android Logger event logtags (see event.logtags) */
#define KILLINFO_LOG_TAG 10195355
@@ -2844,6 +2845,15 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
}
}
+ /* Check if a cached app should be killed */
+ if (kill_reason == NONE && wmark < WMARK_HIGH) {
+ /* TODO: introduce a new kill reason */
+ kill_reason = LOW_MEM_AND_SWAP;
+ snprintf(kill_desc, sizeof(kill_desc), "%s watermark is breached",
+ wmark < WMARK_LOW ? "min" : "low");
+ min_score_adj = PREVIOUS_APP_ADJ + 1;
+ }
+
/* Kill a process if necessary */
if (kill_reason != NONE) {
struct kill_info ki = {