add min score option to PRESSURE_AFTER_KILL am: 18578a55d0

Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2868426

Change-Id: I4784e9fd8ebec9c72ceb7d642ca5aba0ff16dc5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Matt Stephenson 2023-12-12 01:03:37 +00:00 committed by Automerger Merge Worker
commit 3fe819c85f
2 changed files with 8 additions and 0 deletions

View File

@ -88,6 +88,10 @@ properties:
- `ro.lmk.psi_complete_stall_ms`: complete PSI stall threshold in milliseconds for - `ro.lmk.psi_complete_stall_ms`: complete PSI stall threshold in milliseconds for
triggering critical memory notification. Default = triggering critical memory notification. Default =
700 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 lmkd will set the following Android properties according to current system
configurations: configurations:

View File

@ -204,6 +204,7 @@ static int64_t downgrade_pressure;
static bool low_ram_device; static bool low_ram_device;
static bool kill_heaviest_task; static bool kill_heaviest_task;
static unsigned long kill_timeout_ms; static unsigned long kill_timeout_ms;
static int pressure_after_kill_min_score;
static bool use_minfree_levels; static bool use_minfree_levels;
static bool per_app_memcg; static bool per_app_memcg;
static int swap_free_low_percentage; 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 * 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. * 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; kill_reason = PRESSURE_AFTER_KILL;
strncpy(kill_desc, "min watermark is breached even after kill", sizeof(kill_desc)); strncpy(kill_desc, "min watermark is breached even after kill", sizeof(kill_desc));
} else if (level == VMPRESS_LEVEL_CRITICAL && events != 0) { } 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); low_ram_device = property_get_bool("ro.config.low_ram", false);
kill_timeout_ms = kill_timeout_ms =
(unsigned long)GET_LMK_PROPERTY(int32, "kill_timeout_ms", 100); (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 = use_minfree_levels =
GET_LMK_PROPERTY(bool, "use_minfree_levels", false); GET_LMK_PROPERTY(bool, "use_minfree_levels", false);
per_app_memcg = per_app_memcg =