aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-07-31 19:43:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 21:42:45 -0400
commit876aafbfd9ba5bb352f1b14622c27f3fe9a99013 (patch)
treefdd18b6caa0c9baa56b76feb9b05339919f283dd /mm/memcontrol.c
parent6b0c81b3be114a93f79bd4c5639ade5107d77c21 (diff)
mm, memcg: move all oom handling to memcontrol.c
By globally defining check_panic_on_oom(), the memcg oom handler can be moved entirely to mm/memcontrol.c. This removes the ugly #ifdef in the oom killer and cleans up the code. Signed-off-by: David Rientjes <rientjes@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Oleg Nesterov <oleg@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 77a29cea5d76..0f692a2dbfcb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1469,8 +1469,8 @@ static u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
1469 return min(limit, memsw); 1469 return min(limit, memsw);
1470} 1470}
1471 1471
1472void __mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, 1472void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
1473 int order) 1473 int order)
1474{ 1474{
1475 struct mem_cgroup *iter; 1475 struct mem_cgroup *iter;
1476 unsigned long chosen_points = 0; 1476 unsigned long chosen_points = 0;
@@ -1478,6 +1478,17 @@ void __mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
1478 unsigned int points = 0; 1478 unsigned int points = 0;
1479 struct task_struct *chosen = NULL; 1479 struct task_struct *chosen = NULL;
1480 1480
1481 /*
1482 * If current has a pending SIGKILL, then automatically select it. The
1483 * goal is to allow it to allocate so that it may quickly exit and free
1484 * its memory.
1485 */
1486 if (fatal_signal_pending(current)) {
1487 set_thread_flag(TIF_MEMDIE);
1488 return;
1489 }
1490
1491 check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, order, NULL);
1481 totalpages = mem_cgroup_get_limit(memcg) >> PAGE_SHIFT ? : 1; 1492 totalpages = mem_cgroup_get_limit(memcg) >> PAGE_SHIFT ? : 1;
1482 for_each_mem_cgroup_tree(iter, memcg) { 1493 for_each_mem_cgroup_tree(iter, memcg) {
1483 struct cgroup *cgroup = iter->css.cgroup; 1494 struct cgroup *cgroup = iter->css.cgroup;