aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Stephenson <stephensonmatt@google.com>2023-11-27 19:04:18 +0000
committerMatt Stephenson <stephensonmatt@google.com>2023-12-11 22:35:50 +0000
commit18578a55d043b66109c4d94a518c3f31536d75e6 (patch)
tree07165b1bc99c6ef94e48d6e14d3dbffa3b9b1be5
parent5789f8506ad137a9597faf7f6482d05d41d6a008 (diff)
downloadlmkd-18578a55d043b66109c4d94a518c3f31536d75e6.tar.gz
add min score option to PRESSURE_AFTER_KILL
Adjust lmk cycle after kill to honor an optional min score. Test: cycle after kill under mem pressure honors specified score Bug: 309380316 Change-Id: I9ab8e29b58846cc291acb2834638ddf7a7759eca Signed-off-by: Matt Stephenson <stephensonmatt@google.com>
-rw-r--r--README.md4
-rw-r--r--lmkd.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/README.md b/README.md
index 538c410..ae406e3 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,10 @@ properties:
- `ro.lmk.psi_complete_stall_ms`: complete PSI stall threshold in milliseconds for
triggering critical memory notification. Default =
700
+ - `ro.lmk.pressure_after_kill_min_score`: min oom_adj_score score threshold for
+ cycle after kill used to allow blocking of killing
+ critical processes when not enough memory was freed
+ in a kill cycle. Default score = 0.
lmkd will set the following Android properties according to current system
configurations:
diff --git a/lmkd.cpp b/lmkd.cpp
index 1e4d952..767f5d4 100644
--- a/lmkd.cpp
+++ b/lmkd.cpp
@@ -204,6 +204,7 @@ static int64_t downgrade_pressure;
static bool low_ram_device;
static bool kill_heaviest_task;
static unsigned long kill_timeout_ms;
+static int pressure_after_kill_min_score;
static bool use_minfree_levels;
static bool per_app_memcg;
static int swap_free_low_percentage;
@@ -2769,6 +2770,7 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
* This might happen when a process is consuming memory faster than reclaim can
* free even after a kill. Mostly happens when running memory stress tests.
*/
+ min_score_adj = pressure_after_kill_min_score;
kill_reason = PRESSURE_AFTER_KILL;
strncpy(kill_desc, "min watermark is breached even after kill", sizeof(kill_desc));
} else if (level == VMPRESS_LEVEL_CRITICAL && events != 0) {
@@ -3771,6 +3773,8 @@ static bool update_props() {
low_ram_device = property_get_bool("ro.config.low_ram", false);
kill_timeout_ms =
(unsigned long)GET_LMK_PROPERTY(int32, "kill_timeout_ms", 100);
+ pressure_after_kill_min_score =
+ (unsigned long)GET_LMK_PROPERTY(int32, "pressure_after_kill_min_score", 0);
use_minfree_levels =
GET_LMK_PROPERTY(bool, "use_minfree_levels", false);
per_app_memcg =