diff options
author | Robert Benea <robenea@google.com> | 2017-09-11 16:53:28 -0700 |
---|---|---|
committer | Robert Benea <robenea@google.com> | 2017-09-11 16:57:26 -0700 |
commit | 164baebc0173500b4317529b7e942100c45c7191 (patch) | |
tree | 5aac7a7e360a4b7b042609994c7f7f478ffcd9d0 /lmkd/lmkd.c | |
parent | f6397586ab97a24ffda6c36d9078b495219c0518 (diff) | |
download | core-164baebc0173500b4317529b7e942100c45c7191.tar.gz core-164baebc0173500b4317529b7e942100c45c7191.tar.bz2 core-164baebc0173500b4317529b7e942100c45c7191.zip |
Allow ANDROID_LOW_MEMORY_KILLER to coexist with lmkd
For Go devices fallback to memcg/memory pressure events for LMK.
Go devices will use memcg pressure events while inkernel module
is disabled.
Bug: 64852905
Test: tested on gobo
Change-Id: I267ab00be85e324331f6c91551ba013184de817e
Diffstat (limited to 'lmkd/lmkd.c')
-rw-r--r-- | lmkd/lmkd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c index 08eff0901..e26b2271a 100644 --- a/lmkd/lmkd.c +++ b/lmkd/lmkd.c @@ -70,6 +70,7 @@ enum lmk_cmd { /* default to old in-kernel interface if no memory pressure events */ static int use_inkernel_interface = 1; +static bool has_inkernel_module; /* memory pressure level medium event */ static int mpevfd[2]; @@ -81,6 +82,7 @@ static int critical_oomadj; static bool debug_process_killing; static bool enable_pressure_upgrade; static int64_t upgrade_pressure; +static bool is_go_device; /* control socket listen and data */ static int ctrl_lfd; @@ -332,7 +334,7 @@ static void cmd_target(int ntargets, int *params) { lowmem_targets_size = ntargets; - if (use_inkernel_interface) { + if (has_inkernel_module) { char minfreestr[128]; char killpriostr[128]; @@ -347,9 +349,9 @@ static void cmd_target(int ntargets, int *params) { strlcat(killpriostr, ",", sizeof(killpriostr)); } - snprintf(val, sizeof(val), "%d", lowmem_minfree[i]); + snprintf(val, sizeof(val), "%d", use_inkernel_interface ? lowmem_minfree[i] : 0); strlcat(minfreestr, val, sizeof(minfreestr)); - snprintf(val, sizeof(val), "%d", lowmem_adj[i]); + snprintf(val, sizeof(val), "%d", use_inkernel_interface ? lowmem_adj[i] : 0); strlcat(killpriostr, val, sizeof(killpriostr)); } @@ -821,7 +823,8 @@ static int init(void) { } maxevents++; - use_inkernel_interface = !access(INKERNEL_MINFREE_PATH, W_OK); + has_inkernel_module = !access(INKERNEL_MINFREE_PATH, W_OK); + use_inkernel_interface = has_inkernel_module && !is_go_device; if (use_inkernel_interface) { ALOGI("Using in-kernel low memory killer interface"); @@ -875,6 +878,7 @@ int main(int argc __unused, char **argv __unused) { debug_process_killing = property_get_bool("ro.lmk.debug", false); enable_pressure_upgrade = property_get_bool("ro.lmk.critical_upgrade", false); upgrade_pressure = (int64_t)property_get_int32("ro.lmk.upgrade_pressure", 50); + is_go_device = property_get_bool("ro.config.low_ram", false); mlockall(MCL_FUTURE); sched_setscheduler(0, SCHED_FIFO, ¶m); |