X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=mm%2Foom_kill.c;h=3291e82d4352423cb1cd747eaa589da4b8a07a74;hb=02133b9e54ed19e07348ff7abf75aeb92c94d901;hp=054ff47c4478ddb6d6ef77cb66f6fd8330bdbea4;hpb=93abdb7785503c269e73e811f3c7fd23a9243b14;p=firefly-linux-kernel-4.4.55.git diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 054ff47c4478..3291e82d4352 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -178,7 +178,7 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg, * implementation used by LSMs. */ if (has_capability_noaudit(p, CAP_SYS_ADMIN)) - adj -= 30; + points -= (points * 3) / 100; /* Normalize to oom_score_adj units */ adj *= totalpages / 1000; @@ -327,10 +327,14 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, break; }; points = oom_badness(p, NULL, nodemask, totalpages); - if (points > chosen_points) { - chosen = p; - chosen_points = points; - } + if (!points || points < chosen_points) + continue; + /* Prefer thread group leaders for display purposes */ + if (points == chosen_points && thread_group_leader(chosen)) + continue; + + chosen = p; + chosen_points = points; } if (chosen) get_task_struct(chosen);