aboutsummaryrefslogtreecommitdiff
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorThomas Wendt <thoemy@gmx.net>2014-11-12 23:20:34 +0100
committerZips <hcolmenares@gmail.com>2014-11-13 13:53:12 -0500
commit78d665cd45336f49cdb9361d97bf4e9e351da5f5 (patch)
tree8e95eb90174c8925f625efd477a9eaa6126c9235 /kernel/cgroup.c
parent1f1c4b90a5edd4c803f7520665569bc1191278d2 (diff)
Merge tag 'android-5.0.0_r0.6' into aicplp5.0
Android 5.0.0 Release 0.6 Change-Id: I1f0e5fc82aa17b23a414422e3e2851724a2d8e40
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 54a36fe288f..0e4298fc19a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -272,7 +272,7 @@ static void check_for_release(struct cgroup *cgrp);
/*
* A queue for waiters to do rmdir() cgroup. A tasks will sleep when
- * cgroup->count == 0 && list_empty(&cgroup->children) && subsys has some
+ * list_empty(&cgroup->children) && subsys has some
* reference to css->refcnt. In general, this refcnt is expected to goes down
* to zero, soon.
*
@@ -3935,6 +3935,10 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
struct cgroup_subsys *ss;
unsigned long flags;
bool failed = false;
+
+ if (atomic_read(&cgrp->count) != 0)
+ return false;
+
local_irq_save(flags);
for_each_subsys(cgrp->root, ss) {
struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
@@ -3977,19 +3981,23 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
return !failed;
}
-/* checks if all of the css_sets attached to a cgroup have a refcount of 0.
- * Must be called with css_set_lock held */
+/* Checks if all of the css_sets attached to a cgroup have a refcount of 0. */
static int cgroup_css_sets_empty(struct cgroup *cgrp)
{
struct cg_cgroup_link *link;
+ int retval = 1;
+ read_lock(&css_set_lock);
list_for_each_entry(link, &cgrp->css_sets, cgrp_link_list) {
struct css_set *cg = link->cg;
- if (atomic_read(&cg->refcount) > 0)
- return 0;
+ if (atomic_read(&cg->refcount) > 0) {
+ retval = 0;
+ break;
+ }
}
+ read_unlock(&css_set_lock);
- return 1;
+ return retval;
}
static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)