Skip to contentSkip to conversation

cgroup: remove some useless forward declarations

PATCH In review Li Zefan 2 participants 6 messages Sep 17, 2014 cgroup

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/4 cgroup: remove some useless forward declarations

---
 include/linux/cgroup.h | 1 -
 kernel/cgroup.c        | 2 --
 2 files changed, 3 deletions(-)
include/linux/cgroup.h +0 -1
index b5223c5..f7898e0 100644
@@ -27,7 +27,6 @@
 
 struct cgroup_root;
 struct cgroup_subsys;
-struct inode;
 struct cgroup;
 
 extern int cgroup_init_early(void);
kernel/cgroup.c +0 -2
index 940aced..0ce9d9e 100644
@@ -185,7 +185,6 @@ static int need_forkexit_callback __read_mostly;
 static struct cftype cgroup_dfl_base_files[];
 static struct cftype cgroup_legacy_base_files[];
 
-static void cgroup_put(struct cgroup *cgrp);
 static int rebind_subsystems(struct cgroup_root *dst_root,
 			     unsigned int ss_mask);
 static int cgroup_destroy_locked(struct cgroup *cgrp);
@@ -195,7 +194,6 @@ static void css_release(struct percpu_ref *ref);
 static void kill_css(struct cgroup_subsys_state *css);
 static int cgroup_addrm_files(struct cgroup *cgrp, struct cftype cfts[],
 			      bool is_add);
-static void cgroup_pidlist_destroy_all(struct cgroup *cgrp);
 
 /* IDR wrappers which synchronize using cgroup_idr_lock */
 static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
Signature · 1 line
1.8.0.2
author
#1 lore raw

PATCH 2/4 ccgroup: remove redundant code in cgroup_rmdir()

We no longer clear kn->priv in cgroup_rmdir(), so we don't need to get an extra refcnt.

---
 kernel/cgroup.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/cgroup.c +0 -3
index 0ce9d9e..26b8cb9 100644
@@ -4841,13 +4841,10 @@ static int cgroup_rmdir(struct kernfs_node *kn)
 	cgrp = cgroup_kn_lock_live(kn);
 	if (!cgrp)
 		return 0;
-	cgroup_get(cgrp);	/* for @kn->priv clearing */
 
 	ret = cgroup_destroy_locked(cgrp);
 
 	cgroup_kn_unlock(kn);
-
-	cgroup_put(cgrp);
 	return ret;
 }
 
Signature · 1 line
1.8.0.2
author
#2 lore raw

PATCH 3/4 cgroup: remove bogus comments

In reply to Li Zefan

We never grab cgroup mutex in fork and exit paths no matter whether notify_on_release is set or not.

---
 kernel/cgroup.c | 8 --------
 1 file changed, 8 deletions(-)
kernel/cgroup.c +0 -8
index 26b8cb9..1abb554 100644
@@ -967,14 +967,6 @@ static struct cgroup *task_cgroup_from_root(struct task_struct *task,
  * knows that the cgroup won't be removed, as cgroup_rmdir()
  * needs that mutex.
  *
- * The fork and exit callbacks cgroup_fork() and cgroup_exit(), don't
- * (usually) take cgroup_mutex.  These are the two most performance
- * critical pieces of code here.  The exception occurs on cgroup_exit(),
- * when a task in a notify_on_release cgroup exits.  Then cgroup_mutex
- * is taken, and if the cgroup count is zero, a usermode call made
- * to the release agent with the name of the cgroup (path relative to
- * the root of cgroup file system) as the argument.
- *
  * A cgroup can only be deleted if both its 'count' of using tasks
  * is zero, and its list of 'children' cgroups is empty.  Since all
  * tasks in the system use _some_ cgroup, and since there is always at
Signature · 1 line
1.8.0.2
maintainer
#3 lore raw

Re: [PATCH 3/4] cgroup: remove bogus comments

Quoted 4 lines · Li Zefan

We never grab cgroup mutex in fork and exit paths no matter whether notify_on_release is set or not.

Applied 1-3 to cgroup/for-3.18.

Thanks.

Signature · 1 line
tejun
author
#4 lore raw

PATCH 4/4 cgroup: reuse css->destroy_work for release agent

In reply to Li Zefan

Currently we use a global work to schedule release agent on removable cgroups. We can change to reuse css->destroy_work to do this, which saves a few lines of code.

---
 include/linux/cgroup.h |   7 ----
 kernel/cgroup.c        | 108 ++++++++++++++++++-------------------------------
 2 files changed, 39 insertions(+), 76 deletions(-)
include/linux/cgroup.h +0 -7
index f7898e0..97da407 100644
@@ -234,13 +234,6 @@ struct cgroup {
 	struct list_head e_csets[CGROUP_SUBSYS_COUNT];
 
 	/*
-	 * Linked list running through all cgroups that can
-	 * potentially be reaped by the release agent. Protected by
-	 * release_list_lock
-	 */
-	struct list_head release_list;
-
-	/*
 	 * list of pidlists, up to two for each namespace (one for procs, one
 	 * for tasks); created on demand.
 	 */
kernel/cgroup.c +39 -69

149 lines not on this page · raw message

Signature · 1 line
1.8.0.2
maintainer
#5 lore raw

Re: [PATCH 4/4] cgroup: reuse css->destroy_work for release agent

Quoted 5 lines · Li Zefan

Currently we use a global work to schedule release agent on removable cgroups. We can change to reuse css->destroy_work to do this, which saves a few lines of code.

...

kernel/cgroup.c static void init_cgroup_housekeeping(struct cgroup *cgrp) · line 1584

Quoted 5 lines
kernel/cgroup.c +1 -0
@@ -1587,6 +1581,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
 		INIT_LIST_HEAD(&cgrp->e_csets[ssid]);
 
 	init_waitqueue_head(&cgrp->offline_waitq);
+	INIT_WORK(&cgrp->self.destroy_work, cgroup_release_agent);

It's weird to overload destroy_work like this as invoking release_agent isn't necessarily related to destruction. I like the change overall but can we please just use a separate work item?

Thanks.

Signature · 1 line
tejun