[PATCH v2 4/6] cgroups: Mark some subsystems bindable/unbindable

From: Li Zefan
Date: Wed Dec 15 2010 - 04:36:14 EST


For those subsystems (debug, cpuacct, net_cls and devices),
setting the bindable/unbindable flag is sufficient.

Set freezer subsystem as bindable but not unbindable, because
sub-cgroups' can be in FROZEN state.

Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
---
kernel/cgroup.c | 6 +++++-
kernel/cgroup_freezer.c | 1 +
kernel/sched.c | 2 ++
security/device_cgroup.c | 2 ++
4 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 463575d..fa2c5de 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1063,6 +1063,8 @@ static int hierarchy_reset_css_refs(struct cgroup *cgrp, void *data)
int i;

for_each_set_bit(i, &removed_bits, CGROUP_SUBSYS_COUNT) {
+ struct cgroup_subsys_state *css = cgrp->subsys[i];
+
if (atomic_read(&css->refcnt) == 0)
atomic_set(&css->refcnt, 1);
}
@@ -1086,7 +1088,7 @@ static int hierarchy_clear_css_refs(struct cgroup *cgrp, void *data)
}
return 0;
failed:
- hierarchy_reset_css_refs(struct cgroup *cgrp, void *data);
+ hierarchy_reset_css_refs(cgrp, data);
return -EBUSY;
}

@@ -5201,5 +5203,7 @@ struct cgroup_subsys debug_subsys = {
.destroy = debug_destroy,
.populate = debug_populate,
.subsys_id = debug_subsys_id,
+ .bindable = true,
+ .unbindable = true,
};
#endif /* CONFIG_CGROUP_DEBUG */
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index e7bebb7..213ecd9 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -393,4 +393,5 @@ struct cgroup_subsys freezer_subsys = {
.attach = NULL,
.fork = freezer_fork,
.exit = NULL,
+ .bindable = true,
};
diff --git a/kernel/sched.c b/kernel/sched.c
index dc91a4d..930ee2e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9346,6 +9346,8 @@ struct cgroup_subsys cpuacct_subsys = {
.destroy = cpuacct_destroy,
.populate = cpuacct_populate,
.subsys_id = cpuacct_subsys_id,
+ .bindable = true,
+ .unbindable = true,
};
#endif /* CONFIG_CGROUP_CPUACCT */

diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 8d9c48f..51321e9 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -473,6 +473,8 @@ struct cgroup_subsys devices_subsys = {
.destroy = devcgroup_destroy,
.populate = devcgroup_populate,
.subsys_id = devices_subsys_id,
+ .bindable = true,
+ .unbindable = true,
};

int devcgroup_inode_permission(struct inode *inode, int mask)
--
1.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/