aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/memcontrol.c19
-rw-r--r--mm/oom_kill.c12
2 files changed, 20 insertions, 11 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9537e1389ee6..c8336e8f8df0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1841,13 +1841,18 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
1841 break; 1841 break;
1842 }; 1842 };
1843 points = oom_badness(task, memcg, NULL, totalpages); 1843 points = oom_badness(task, memcg, NULL, totalpages);
1844 if (points > chosen_points) { 1844 if (!points || points < chosen_points)
1845 if (chosen) 1845 continue;
1846 put_task_struct(chosen); 1846 /* Prefer thread group leaders for display purposes */
1847 chosen = task; 1847 if (points == chosen_points &&
1848 chosen_points = points; 1848 thread_group_leader(chosen))
1849 get_task_struct(chosen); 1849 continue;
1850 } 1850
1851 if (chosen)
1852 put_task_struct(chosen);
1853 chosen = task;
1854 chosen_points = points;
1855 get_task_struct(chosen);
1851 } 1856 }
1852 css_task_iter_end(&it); 1857 css_task_iter_end(&it);
1853 } 1858 }
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 054ff47c4478..37b1b1903fb2 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -327,10 +327,14 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
327 break; 327 break;
328 }; 328 };
329 points = oom_badness(p, NULL, nodemask, totalpages); 329 points = oom_badness(p, NULL, nodemask, totalpages);
330 if (points > chosen_points) { 330 if (!points || points < chosen_points)
331 chosen = p; 331 continue;
332 chosen_points = points; 332 /* Prefer thread group leaders for display purposes */
333 } 333 if (points == chosen_points && thread_group_leader(chosen))
334 continue;
335
336 chosen = p;
337 chosen_points = points;
334 } 338 }
335 if (chosen) 339 if (chosen)
336 get_task_struct(chosen); 340 get_task_struct(chosen);