[Devel] [PATCH] cgroup: Check task_lock in task_subsys_state()

Li Zefan lizf at cn.fujitsu.com
Thu Apr 22 19:35:52 PDT 2010


task_subsys_state() is safe under task_lock(). See
Documentation/cgroups/cgroups.txt for locking rule.

This fixes an RCU warning when resume from suspend. The
warning comes from freezer cgroup in cgroup_freezing_or_frozen().

Signed-off-by: Li Zefan <lizf at cn.fujitsu.com>
---

I'm not sure which is preferable - access ->alloc_lock directly
like this patch or add task_lock_is_held() in sched.h

---
 include/linux/cgroup.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b8ad1ea..8f78073 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -530,6 +530,7 @@ static inline struct cgroup_subsys_state *task_subsys_state(
 {
 	return rcu_dereference_check(task->cgroups->subsys[subsys_id],
 				     rcu_read_lock_held() ||
+				     lockdep_is_held(&task->alloc_lock) ||
 				     cgroup_lock_is_held());
 }
 
-- 
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