]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
cgroup: move subsys file removal to kill_css()
authorTejun Heo <tj@kernel.org>
Wed, 14 Aug 2013 00:22:51 +0000 (20:22 -0400)
committerTejun Heo <tj@kernel.org>
Wed, 14 Aug 2013 00:22:51 +0000 (20:22 -0400)
With the planned unified hierarchy, individual css's will be created
and destroyed dynamically across the lifetime of a cgroup.  To enable
such usages, css destruction is being decoupled from cgroup
destruction.  This patch moves subsys file removal from
cgroup_destroy_locked() to kill_css().

While this changes the order of destruction operations, the changes
shouldn't be noticeable to cgroup subsystems or userland.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cgroup.c

index 7b7575f3119cc043d2766450a4ca32690e961cd0..3137e38995b03c8e871506eb0a9bce235f3c1334 100644 (file)
@@ -4599,13 +4599,15 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
  * kill_css - destroy a css
  * @css: css to destroy
  *
- * This function initiates destruction of @css by putting its base
- * reference.  ->css_offline() will be invoked asynchronously once
- * css_tryget() is guaranteed to fail and when the reference count reaches
- * zero, @css will be released.
+ * This function initiates destruction of @css by removing cgroup interface
+ * files and putting its base reference.  ->css_offline() will be invoked
+ * asynchronously once css_tryget() is guaranteed to fail and when the
+ * reference count reaches zero, @css will be released.
  */
 static void kill_css(struct cgroup_subsys_state *css)
 {
+       cgroup_clear_dir(css->cgroup, 1 << css->ss->subsys_id);
+
        /*
         * Killing would put the base ref, but we need to keep it alive
         * until after ->css_offline().
@@ -4703,10 +4705,10 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
                cgroup_destroy_css_killed(cgrp);
 
        /*
-        * Clear and remove @cgrp directory.  The removal puts the base ref
-        * but we aren't quite done with @cgrp yet, so hold onto it.
+        * Clear the base files and remove @cgrp directory.  The removal
+        * puts the base ref but we aren't quite done with @cgrp yet, so
+        * hold onto it.
         */
-       cgroup_clear_dir(cgrp, cgrp->root->subsys_mask);
        cgroup_addrm_files(cgrp, cgroup_base_files, false);
        dget(d);
        cgroup_d_remove_dir(d);