gdt-A20

导航

start_kernel----cgroup_init_early<五>

In kernel/cgroup.c

 1 /**
2 * cgroup_init_early - cgroup initialization at system boot
3 *
4 * Initialize cgroups at system boot, and initialize any
5 * subsystems that request early init.
6 */
7 int __init cgroup_init_early(void)
8 {
9 int i;
10 atomic_set(&init_css_set.refcount, 1);
11 INIT_LIST_HEAD(&init_css_set.cg_links);
12 INIT_LIST_HEAD(&init_css_set.tasks);
13 INIT_HLIST_NODE(&init_css_set.hlist);
14 css_set_count = 1;
15 init_cgroup_root(&rootnode);
16 root_count = 1;
17 init_task.cgroups = &init_css_set;
18
19 init_css_set_link.cg = &init_css_set;
20 init_css_set_link.cgrp = dummytop;
21 list_add(&init_css_set_link.cgrp_link_list,
22 &rootnode.top_cgroup.css_sets);
23 list_add(&init_css_set_link.cg_link_list,
24 &init_css_set.cg_links);
25
26 for (i = 0; i < CSS_SET_TABLE_SIZE; i++)
27 INIT_HLIST_HEAD(&css_set_table[i]);
28
29 /* at bootup time, we don't worry about modular subsystems */
30 for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
31 struct cgroup_subsys *ss = subsys[i];
32
33 BUG_ON(!ss->name);
34 BUG_ON(strlen(ss->name) > MAX_CGROUP_TYPE_NAMELEN);
35 BUG_ON(!ss->create);
36 BUG_ON(!ss->destroy);
37 if (ss->subsys_id != i) {
38 printk(KERN_ERR "cgroup: Subsys %s id == %d\n",
39 ss->name, ss->subsys_id);
40 BUG();
41 }
42
43 if (ss->early_init)
44 cgroup_init_subsys(ss);
45 }
46 return 0;
47 }

 

posted on 2012-01-15 23:18  gdt-A20  阅读(946)  评论(0编辑  收藏  举报