lmkd: update watermarks before the first kill am: 20de82dde2 am: af9d7fe055

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

Change-Id: Ia56c0de5b28c9bff4d71390b33beb0f362b211bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Suren Baghdasaryan 2024-04-08 16:03:29 +00:00 committed by Automerger Merge Worker
commit 7c2e756562
1 changed files with 9 additions and 0 deletions

View File

@ -2807,6 +2807,7 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
max_thrashing = thrashing;
}
update_watermarks:
/*
* Refresh watermarks once per min in case user updated one of the margins.
* TODO: b/140521024 replace this periodic update with an API for AMS to notify LMKD
@ -2942,6 +2943,14 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
.thrashing = (int)thrashing,
.max_thrashing = max_thrashing,
};
static bool first_kill = true;
/* Make sure watermarks are correct before the first kill */
if (first_kill) {
first_kill = false;
watermarks.high_wmark = 0; // force recomputation
goto update_watermarks;
}
/* Allow killing perceptible apps if the system is stalled */
if (critical_stall) {