aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/cgroup.h3
-rw-r--r--kernel/cgroup.c29
2 files changed, 9 insertions, 23 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1ba4fc08f776..c4350a82320b 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -604,9 +604,8 @@ struct cgroup_subsys {
604 /* list of cftype_sets */ 604 /* list of cftype_sets */
605 struct list_head cftsets; 605 struct list_head cftsets;
606 606
607 /* base cftypes, automatically [de]registered with subsys itself */ 607 /* base cftypes, automatically registered with subsys itself */
608 struct cftype *base_cftypes; 608 struct cftype *base_cftypes;
609 struct cftype_set base_cftset;
610}; 609};
611 610
612#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; 611#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3f204429d108..eb002c622cd6 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4503,25 +4503,6 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
4503 return ret; 4503 return ret;
4504} 4504}
4505 4505
4506static void __init cgroup_init_cftsets(struct cgroup_subsys *ss)
4507{
4508 INIT_LIST_HEAD(&ss->cftsets);
4509
4510 /*
4511 * base_cftset is embedded in subsys itself, no need to worry about
4512 * deregistration.
4513 */
4514 if (ss->base_cftypes) {
4515 struct cftype *cft;
4516
4517 for (cft = ss->base_cftypes; cft->name[0] != '\0'; cft++)
4518 cft->ss = ss;
4519
4520 ss->base_cftset.cfts = ss->base_cftypes;
4521 list_add_tail(&ss->base_cftset.node, &ss->cftsets);
4522 }
4523}
4524
4525static void __init cgroup_init_subsys(struct cgroup_subsys *ss) 4506static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
4526{ 4507{
4527 struct cgroup_subsys_state *css; 4508 struct cgroup_subsys_state *css;
@@ -4531,8 +4512,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
4531 mutex_lock(&cgroup_tree_mutex); 4512 mutex_lock(&cgroup_tree_mutex);
4532 mutex_lock(&cgroup_mutex); 4513 mutex_lock(&cgroup_mutex);
4533 4514
4534 /* init base cftset */ 4515 INIT_LIST_HEAD(&ss->cftsets);
4535 cgroup_init_cftsets(ss);
4536 4516
4537 /* Create the top cgroup state for this subsystem */ 4517 /* Create the top cgroup state for this subsystem */
4538 ss->root = &cgroup_dummy_root; 4518 ss->root = &cgroup_dummy_root;
@@ -4621,6 +4601,13 @@ int __init cgroup_init(void)
4621 for_each_subsys(ss, i) { 4601 for_each_subsys(ss, i) {
4622 if (!ss->early_init) 4602 if (!ss->early_init)
4623 cgroup_init_subsys(ss); 4603 cgroup_init_subsys(ss);
4604
4605 /*
4606 * cftype registration needs kmalloc and can't be done
4607 * during early_init. Register base cftypes separately.
4608 */
4609 if (ss->base_cftypes)
4610 WARN_ON(cgroup_add_cftypes(ss, ss->base_cftypes));
4624 } 4611 }
4625 4612
4626 /* allocate id for the dummy hierarchy */ 4613 /* allocate id for the dummy hierarchy */