lmkd: fix higher event being reset by lower and polling start am: c7eca43006

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

Change-Id: I4056be703d748fe559b0f41cdeec20cd790d4b6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Divyanand Rangu 2024-11-19 01:34:02 +00:00 committed by Automerger Merge Worker
commit 534bf94822
1 changed files with 15 additions and 0 deletions

View File

@ -211,6 +211,7 @@ static int mpevfd[VMPRESS_LEVEL_COUNT] = { -1, -1, -1 };
static bool pidfd_supported; static bool pidfd_supported;
static int last_kill_pid_or_fd = -1; static int last_kill_pid_or_fd = -1;
static struct timespec last_kill_tm; static struct timespec last_kill_tm;
enum vmpressure_level prev_level = VMPRESS_LEVEL_LOW;
static bool monitors_initialized; static bool monitors_initialized;
static bool boot_completed_handled = false; static bool boot_completed_handled = false;
@ -2731,6 +2732,20 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
return; return;
} }
if (events > 0 ) {
/* Ignore a lower event within the first polling window. */
if (level < prev_level) {
if (debug_process_killing)
ALOGI("Ignoring %s pressure event; occurred too soon.",
level_name[level]);
return;
}
prev_level = level;
} else {
/* Reset event level after the first polling window. */
prev_level = VMPRESS_LEVEL_LOW;
}
record_wakeup_time(&curr_tm, events ? Event : Polling, &wi); record_wakeup_time(&curr_tm, events ? Event : Polling, &wi);
bool kill_pending = is_kill_pending(); bool kill_pending = is_kill_pending();