]>
Commit | Line | Data |
---|---|---|
4fa517f7 GKH |
1 | From 1f5320d5972aa50d3e8d2b227b636b370e608359 Mon Sep 17 00:00:00 2001 |
2 | From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | |
3 | Date: Thu, 4 Oct 2012 16:37:16 +0900 | |
4 | Subject: cgroup: notify_on_release may not be triggered in some cases | |
5 | ||
6 | From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | |
7 | ||
8 | commit 1f5320d5972aa50d3e8d2b227b636b370e608359 upstream. | |
9 | ||
10 | notify_on_release must be triggered when the last process in a cgroup is | |
11 | move to another. But if the first(and only) process in a cgroup is moved to | |
12 | another, notify_on_release is not triggered. | |
13 | ||
14 | # mkdir /cgroup/cpu/SRC | |
15 | # mkdir /cgroup/cpu/DST | |
16 | # | |
17 | # echo 1 >/cgroup/cpu/SRC/notify_on_release | |
18 | # echo 1 >/cgroup/cpu/DST/notify_on_release | |
19 | # | |
20 | # sleep 300 & | |
21 | [1] 8629 | |
22 | # | |
23 | # echo 8629 >/cgroup/cpu/SRC/tasks | |
24 | # echo 8629 >/cgroup/cpu/DST/tasks | |
25 | -> notify_on_release for /SRC must be triggered at this point, | |
26 | but it isn't. | |
27 | ||
28 | This is because put_css_set() is called before setting CGRP_RELEASABLE | |
29 | in cgroup_task_migrate(), and is a regression introduce by the | |
30 | commit:74a1166d(cgroups: make procs file writable), which was merged | |
31 | into v3.0. | |
32 | ||
33 | Acked-by: Li Zefan <lizefan@huawei.com> | |
34 | Cc: Ben Blum <bblum@andrew.cmu.edu> | |
35 | Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | |
36 | Signed-off-by: Tejun Heo <tj@kernel.org> | |
37 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
38 | ||
39 | --- | |
40 | kernel/cgroup.c | 3 +-- | |
41 | 1 file changed, 1 insertion(+), 2 deletions(-) | |
42 | ||
43 | --- a/kernel/cgroup.c | |
44 | +++ b/kernel/cgroup.c | |
45 | @@ -1923,9 +1923,8 @@ static void cgroup_task_migrate(struct c | |
46 | * trading it for newcg is protected by cgroup_mutex, we're safe to drop | |
47 | * it here; it will be freed under RCU. | |
48 | */ | |
49 | - put_css_set(oldcg); | |
50 | - | |
51 | set_bit(CGRP_RELEASABLE, &oldcgrp->flags); | |
52 | + put_css_set(oldcg); | |
53 | } | |
54 | ||
55 | /** |