]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.6.4/cgroup-notify_on_release-may-not-be-triggered-in-some-cases.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.6.4 / cgroup-notify_on_release-may-not-be-triggered-in-some-cases.patch
CommitLineData
4fa517f7
GKH
1From 1f5320d5972aa50d3e8d2b227b636b370e608359 Mon Sep 17 00:00:00 2001
2From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
3Date: Thu, 4 Oct 2012 16:37:16 +0900
4Subject: cgroup: notify_on_release may not be triggered in some cases
5
6From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
7
8commit 1f5320d5972aa50d3e8d2b227b636b370e608359 upstream.
9
10notify_on_release must be triggered when the last process in a cgroup is
11move to another. But if the first(and only) process in a cgroup is moved to
12another, 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
28This is because put_css_set() is called before setting CGRP_RELEASABLE
29in cgroup_task_migrate(), and is a regression introduce by the
30commit:74a1166d(cgroups: make procs file writable), which was merged
31into v3.0.
32
33Acked-by: Li Zefan <lizefan@huawei.com>
34Cc: Ben Blum <bblum@andrew.cmu.edu>
35Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
36Signed-off-by: Tejun Heo <tj@kernel.org>
37Signed-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 /**