Skip to content
Snippets Groups Projects
Commit 20686f06 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan
Browse files

lmkd: Do not set soft_limit_in_bytes on high-end devices


Setting memory.soft_limit_in_bytes on high-end devices with large memory
reserves affects performance of memory-hungry applications that have
large workingsets and keep thrashing because of the memory limits imposed.
Limit the usage of memory.soft_limit_in_bytes to low-memory devices only.
Add debug messages for future troubleshooting to capture cases when
vmpressure events are being ignored.

Bug: 78916015
Test: collect vmstat while running a heavy app
Change-Id: Ib4434b96d2be802ef89960b573486eae8d12f198
Merged-In: Ib4434b96d2be802ef89960b573486eae8d12f198
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
parent 34de3c84
No related branches found
No related tags found
No related merge requests found
...@@ -459,6 +459,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet) { ...@@ -459,6 +459,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet) {
if (use_inkernel_interface) if (use_inkernel_interface)
return; return;
if (low_ram_device) {
if (params.oomadj >= 900) { if (params.oomadj >= 900) {
soft_limit_mult = 0; soft_limit_mult = 0;
} else if (params.oomadj >= 800) { } else if (params.oomadj >= 800) {
...@@ -492,6 +493,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet) { ...@@ -492,6 +493,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet) {
params.uid, params.pid); params.uid, params.pid);
snprintf(val, sizeof(val), "%d", soft_limit_mult * EIGHT_MEGA); snprintf(val, sizeof(val), "%d", soft_limit_mult * EIGHT_MEGA);
writefilestring(path, val); writefilestring(path, val);
}
procp = pid_lookup(params.pid); procp = pid_lookup(params.pid);
if (!procp) { if (!procp) {
...@@ -1214,8 +1216,15 @@ static void mp_event_common(int data, uint32_t events __unused) { ...@@ -1214,8 +1216,15 @@ static void mp_event_common(int data, uint32_t events __unused) {
} }
} }
if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) {
if (debug_process_killing) {
ALOGI("Ignore %s memory pressure event "
"(free memory=%ldkB, cache=%ldkB, limit=%ldkB)",
level_name[level], other_free * page_k, other_file * page_k,
(long)lowmem_minfree[lowmem_targets_size - 1] * page_k);
}
return; return;
}
/* Free up enough pages to push over the highest minfree level */ /* Free up enough pages to push over the highest minfree level */
pages_to_free = lowmem_minfree[lowmem_targets_size - 1] - pages_to_free = lowmem_minfree[lowmem_targets_size - 1] -
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment