lmkd: fix higher event being reset by lower and polling start
When both Medium and Critical events occur at same time, depending on how the events are queued, the later event resets the former event. We'd want the subsequent polling (till next event is triggered) to happen with higher event. So, it is fine if Critical event overrides Medium, but not other way around. Let's see below scenario where both Medium and Critical events occur (at T0) and handled one after other T0: critical event handled. T0 + 2ms: medium event handled. T0 + 102ms: medium event polling check. //This should be critical poll Bug: 376003899 Change-Id: I16ff3b999d7531435324a628ac17968fd4cae8cf
This commit is contained in:
parent
f32fe4d7d3
commit
c7eca43006
15
lmkd.cpp
15
lmkd.cpp
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue