diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index c447c29f8749..b893c8c94858 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2477,7 +2477,6 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) | |||
2477 | static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | 2477 | static void __init cgroup_init_subsys(struct cgroup_subsys *ss) |
2478 | { | 2478 | { |
2479 | struct cgroup_subsys_state *css; | 2479 | struct cgroup_subsys_state *css; |
2480 | struct list_head *l; | ||
2481 | 2480 | ||
2482 | printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); | 2481 | printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); |
2483 | 2482 | ||
@@ -2488,35 +2487,19 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | |||
2488 | BUG_ON(IS_ERR(css)); | 2487 | BUG_ON(IS_ERR(css)); |
2489 | init_cgroup_css(css, ss, dummytop); | 2488 | init_cgroup_css(css, ss, dummytop); |
2490 | 2489 | ||
2491 | /* Update all cgroup groups to contain a subsys | 2490 | /* Update the init_css_set to contain a subsys |
2492 | * pointer to this state - since the subsystem is | 2491 | * pointer to this state - since the subsystem is |
2493 | * newly registered, all tasks and hence all cgroup | 2492 | * newly registered, all tasks and hence the |
2494 | * groups are in the subsystem's top cgroup. */ | 2493 | * init_css_set is in the subsystem's top cgroup. */ |
2495 | write_lock(&css_set_lock); | 2494 | init_css_set.subsys[ss->subsys_id] = dummytop->subsys[ss->subsys_id]; |
2496 | l = &init_css_set.list; | ||
2497 | do { | ||
2498 | struct css_set *cg = | ||
2499 | list_entry(l, struct css_set, list); | ||
2500 | cg->subsys[ss->subsys_id] = dummytop->subsys[ss->subsys_id]; | ||
2501 | l = l->next; | ||
2502 | } while (l != &init_css_set.list); | ||
2503 | write_unlock(&css_set_lock); | ||
2504 | |||
2505 | /* If this subsystem requested that it be notified with fork | ||
2506 | * events, we should send it one now for every process in the | ||
2507 | * system */ | ||
2508 | if (ss->fork) { | ||
2509 | struct task_struct *g, *p; | ||
2510 | |||
2511 | read_lock(&tasklist_lock); | ||
2512 | do_each_thread(g, p) { | ||
2513 | ss->fork(ss, p); | ||
2514 | } while_each_thread(g, p); | ||
2515 | read_unlock(&tasklist_lock); | ||
2516 | } | ||
2517 | 2495 | ||
2518 | need_forkexit_callback |= ss->fork || ss->exit; | 2496 | need_forkexit_callback |= ss->fork || ss->exit; |
2519 | 2497 | ||
2498 | /* At system boot, before all subsystems have been | ||
2499 | * registered, no tasks have been forked, so we don't | ||
2500 | * need to invoke fork callbacks here. */ | ||
2501 | BUG_ON(!list_empty(&init_task.tasks)); | ||
2502 | |||
2520 | ss->active = 1; | 2503 | ss->active = 1; |
2521 | } | 2504 | } |
2522 | 2505 | ||