lmkd: choose the heaviest task when killing perceptible processes am: 858e8c6373 am: c71ce3fed4
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1619563 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I95dc9527835a28e38feb689ba872ee1101eb5a1a
This commit is contained in:
commit
e1bfcc3cac
11
lmkd.cpp
11
lmkd.cpp
|
|
@ -2163,12 +2163,21 @@ static int find_and_kill_process(int min_score_adj, enum kill_reasons kill_reaso
|
||||||
int i;
|
int i;
|
||||||
int killed_size = 0;
|
int killed_size = 0;
|
||||||
bool lmk_state_change_start = false;
|
bool lmk_state_change_start = false;
|
||||||
|
bool choose_heaviest_task = kill_heaviest_task;
|
||||||
|
|
||||||
for (i = OOM_SCORE_ADJ_MAX; i >= min_score_adj; i--) {
|
for (i = OOM_SCORE_ADJ_MAX; i >= min_score_adj; i--) {
|
||||||
struct proc *procp;
|
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) {
|
while (true) {
|
||||||
procp = kill_heaviest_task ?
|
procp = choose_heaviest_task ?
|
||||||
proc_get_heaviest(i) : proc_adj_lru(i);
|
proc_get_heaviest(i) : proc_adj_lru(i);
|
||||||
|
|
||||||
if (!procp)
|
if (!procp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue