[Devel] [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()
Li Zefan
lizf at cn.fujitsu.com
Thu Apr 22 02:31:20 PDT 2010
with CONFIG_PROVE_RCU, a warning can be triggered when we
resume from suspend:
...
include/linux/cgroup.h:533 invoked rcu_dereference_check() without protection!
...
task_freezer() calls task_subsys_state(), which needs to be
protected by rcu_read_lock or cgroup_mutex.
Signed-off-by: Li Zefan <lizf at cn.fujitsu.com>
---
kernel/cgroup_freezer.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 5038f4c..ac76983 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -53,6 +53,7 @@ int cgroup_freezing_or_frozen(struct task_struct *task)
struct freezer *freezer;
enum freezer_state state;
+ rcu_read_lock();
task_lock(task);
freezer = task_freezer(task);
if (!freezer->css.cgroup->parent)
@@ -60,6 +61,7 @@ int cgroup_freezing_or_frozen(struct task_struct *task)
else
state = freezer->state;
task_unlock(task);
+ rcu_read_unlock();
return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN);
}
--
1.6.3
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list