aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>2009-12-15 19:47:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:07 -0500
commit9ab322caa347c4b580bcaf08f2253ea4cbd9e9ad (patch)
tree3d3344e4ab05fc1047465b439b5cc7f000c44ca2 /mm
parentd31f56dbf8bafaacb0c617f9a6f137498d5c7aed (diff)
memcg: remove memcg_tasklist
memcg_tasklist was introduced at commit 7f4d454d(memcg: avoid deadlock caused by race between oom and cpuset_attach) instead of cgroup_mutex to fix a deadlock problem. The cgroup_mutex, which was removed by the commit, in mem_cgroup_out_of_memory() was originally introduced at commit c7ba5c9e (Memory controller: OOM handling). IIUC, the intention of this cgroup_mutex was to prevent task move during select_bad_process() so that situations like below can be avoided. Assume cgroup "foo" has exceeded its limit and is about to trigger oom. 1. Process A, which has been in cgroup "baa" and uses large memory, is just moved to cgroup "foo". Process A can be the candidates for being killed. 2. Process B, which has been in cgroup "foo" and uses large memory, is just moved from cgroup "foo". Process B can be excluded from the candidates for being killed. But these race window exists anyway even if we hold a lock, because __mem_cgroup_try_charge() decides wether it should trigger oom or not outside of the lock. So the original cgroup_mutex in mem_cgroup_out_of_memory and thus current memcg_tasklist has no use. And IMHO, those races are not so critical for users. This patch removes it and make codes simpler. Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@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')
-rw-r--r--mm/memcontrol.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a294b7576070..1aff6c3fcbd8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -55,7 +55,6 @@ static int really_do_swap_account __initdata = 1; /* for remember boot option*/
55#define do_swap_account (0) 55#define do_swap_account (0)
56#endif 56#endif
57 57
58static DEFINE_MUTEX(memcg_tasklist); /* can be hold under cgroup_mutex */
59#define SOFTLIMIT_EVENTS_THRESH (1000) 58#define SOFTLIMIT_EVENTS_THRESH (1000)
60 59
61/* 60/*
@@ -1481,9 +1480,7 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
1481 1480
1482 if (!nr_retries--) { 1481 if (!nr_retries--) {
1483 if (oom) { 1482 if (oom) {
1484 mutex_lock(&memcg_tasklist);
1485 mem_cgroup_out_of_memory(mem_over_limit, gfp_mask); 1483 mem_cgroup_out_of_memory(mem_over_limit, gfp_mask);
1486 mutex_unlock(&memcg_tasklist);
1487 record_last_oom(mem_over_limit); 1484 record_last_oom(mem_over_limit);
1488 } 1485 }
1489 goto nomem; 1486 goto nomem;
@@ -3393,12 +3390,10 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss,
3393 struct task_struct *p, 3390 struct task_struct *p,
3394 bool threadgroup) 3391 bool threadgroup)
3395{ 3392{
3396 mutex_lock(&memcg_tasklist);
3397 /* 3393 /*
3398 * FIXME: It's better to move charges of this process from old 3394 * FIXME: It's better to move charges of this process from old
3399 * memcg to new memcg. But it's just on TODO-List now. 3395 * memcg to new memcg. But it's just on TODO-List now.
3400 */ 3396 */
3401 mutex_unlock(&memcg_tasklist);
3402} 3397}
3403 3398
3404struct cgroup_subsys mem_cgroup_subsys = { 3399struct cgroup_subsys mem_cgroup_subsys = {