]> Pileus Git - ~andy/linux/blobdiff - mm/oom_kill.c
sit: fix panic with route cache in ip tunnels
[~andy/linux] / mm / oom_kill.c
index 054ff47c4478ddb6d6ef77cb66f6fd8330bdbea4..3291e82d4352423cb1cd747eaa589da4b8a07a74 100644 (file)
@@ -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);