Skip to contentSkip to conversation

cgroup: remove hierarchy_mutex

PATCH Applied Li Zefan 2 participants 2 messages Jun 4, 2012 – Jun 7, 2012

Subsystems (2)
lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 cgroup: remove hierarchy_mutex

It was introduced for memcg to iterate cgroup hierarchy without holding cgroup_mutex, but soon after that it was replaced with a lockless way in memcg.

No one used hierarchy_mutex since that, so remove it.

---
 Documentation/cgroups/cgroups.txt |    2 +-
 include/linux/cgroup.h            |   17 ++------------
 kernel/cgroup.c                   |   45 -------------------------------------
 3 files changed, 3 insertions(+), 61 deletions(-)
Documentation/cgroups/cgroups.txt +1 -1
index 8e74980..e86faae 100644
@@ -656,7 +656,7 @@ example in cpusets, no task may attach before 'cpus' and 'mems' are set
 up.
 
 void bind(struct cgroup *root)
-(cgroup_mutex and ss->hierarchy_mutex held by caller)
+(cgroup_mutex held by caller)
 
 Called when a cgroup subsystem is rebound to a different hierarchy
 and root cgroup. Currently this will only involve movement between
include/linux/cgroup.h +2 -15
index d3f5fba..c90eaa8 100644
@@ -500,21 +500,8 @@ struct cgroup_subsys {
 	const char *name;
 
 	/*
-	 * Protects sibling/children links of cgroups in this
-	 * hierarchy, plus protects which hierarchy (or none) the
-	 * subsystem is a part of (i.e. root/sibling).  To avoid
-	 * potential deadlocks, the following operations should not be
-	 * undertaken while holding any hierarchy_mutex:
-	 *
-	 * - allocating memory
-	 * - initiating hotplug events
-	 */
-	struct mutex hierarchy_mutex;
-	struct lock_class_key subsys_key;
-
-	/*
 	 * Link to parent, and list entry in parent's children.
-	 * Protected by this->hierarchy_mutex and cgroup_lock()
+	 * Protected by cgroup_lock()
 	 */
 	struct cgroupfs_root *root;
 	struct list_head sibling;
@@ -602,7 +589,7 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
  * the lifetime of cgroup_subsys_state is subsys's matter.
  *
  * Looking up and scanning function should be called under rcu_read_lock().
- * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls.
+ * Taking cgroup_mutex is not necessary for following calls.
  * But the css returned by this routine can be "not populated yet" or "being
  * destroyed". The caller should check css and cgroup's status.
  */
kernel/cgroup.c +0 -45

109 lines not on this page · raw message

Signature · 1 line
1.7.9.7
maintainer Applied
#1 lore raw
Quoted 7 lines · Li Zefan

It was introduced for memcg to iterate cgroup hierarchy without holding cgroup_mutex, but soon after that it was replaced with a lockless way in memcg.

No one used hierarchy_mutex since that, so remove it.

Applied to cgroup/for-3.6. Thanks.

Signature · 1 line
tejun