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

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

Change-Id: I7a7a4c767384868cfd4bb909941db83c8d480886
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:56:30 +00:00 committed by Automerger Merge Worker
commit ce5bc38327
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 int last_kill_pid_or_fd = -1;
static struct timespec last_kill_tm;
enum vmpressure_level prev_level = VMPRESS_LEVEL_LOW;
static bool monitors_initialized;
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;
}
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);
bool kill_pending = is_kill_pending();