cgroup: remove some useless forward declarations
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
@@ -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
@@ -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
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
@@ -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
PATCH 3/4 cgroup: remove bogus comments
In reply to Li ZefanWe 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
@@ -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
Tejun Heo
maintainerRe: [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_releaseis set or not.Signed-off-by Zefan Li <[email protected]>
Applied 1-3 to cgroup/for-3.18.
Thanks.
Signature · 1 line
tejun
PATCH 4/4 cgroup: reuse css->destroy_work for release agent
In reply to Li ZefanCurrently 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
@@ -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
Tejun Heo
maintainerRe: [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_workto do this, which saves a few lines of code.Signed-off-by Zefan Li <[email protected]>
...
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