lmkd: choose the heaviest task when killing perceptible processes
When killing a task at or lower than oom_score_adj PERCEPTIBLE_APP_ADJ choose the heaviest task among the ones at that level to try minimizing the number of required kills. Because killing a perceptible app will affect user experience anyway, it makes sense to choose the one that will release the most memory and therefore no more kills might be necessary. Bug: 181778155 Test: running thrashing.py script Signed-off-by: Suren Baghdasaryan <surenb@google.com> Merged-In: I775ff774430b6fde4d619ede794825dbae59fd8e Change-Id: I775ff774430b6fde4d619ede794825dbae59fd8e
This commit is contained in:
parent
140385d3a0
commit
720abce177
11
lmkd.cpp
11
lmkd.cpp
|
|
@ -2153,12 +2153,21 @@ static int find_and_kill_process(int min_score_adj, enum kill_reasons kill_reaso
|
|||
int i;
|
||||
int killed_size = 0;
|
||||
bool lmk_state_change_start = false;
|
||||
bool choose_heaviest_task = kill_heaviest_task;
|
||||
|
||||
for (i = OOM_SCORE_ADJ_MAX; i >= min_score_adj; i--) {
|
||||
struct proc *procp;
|
||||
|
||||
if (!choose_heaviest_task && i <= PERCEPTIBLE_APP_ADJ) {
|
||||
/*
|
||||
* If we have to choose a perceptible process, choose the heaviest one to
|
||||
* hopefully minimize the number of victims.
|
||||
*/
|
||||
choose_heaviest_task = true;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
procp = kill_heaviest_task ?
|
||||
procp = choose_heaviest_task ?
|
||||
proc_get_heaviest(i) : proc_adj_lru(i);
|
||||
|
||||
if (!procp)
|
||||
|
|
|
|||
Loading…
Reference in New Issue