Commit 33a68ac1c1b695216e873ee12e819adbe73e4d9f

Authored by Li Zefan
Committed by Linus Torvalds
1 parent e5f6a8609b

cgroups: add inactive subsystems to rootnode.subsys_list

Though for an inactive hierarchy, we have subsys->root == &rootnode, but
rootnode's subsys_list is always empty.

This conflicts with the code in find_css_set():

	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
		...
		if (ss->root->subsys_list.next == &ss->sibling) {
			...
		}
	}
	if (list_empty(&rootnode.subsys_list)) {
		...
	}

The above code assumes rootnode.subsys_list links all inactive
hierarchies.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -712,7 +712,7 @@
712 712 BUG_ON(dummytop->subsys[i]->cgroup != dummytop);
713 713 cgrp->subsys[i] = dummytop->subsys[i];
714 714 cgrp->subsys[i]->cgroup = cgrp;
715   - list_add(&ss->sibling, &root->subsys_list);
  715 + list_move(&ss->sibling, &root->subsys_list);
716 716 ss->root = root;
717 717 if (ss->bind)
718 718 ss->bind(ss, cgrp);
... ... @@ -726,7 +726,7 @@
726 726 dummytop->subsys[i]->cgroup = dummytop;
727 727 cgrp->subsys[i] = NULL;
728 728 subsys[i]->root = &rootnode;
729   - list_del(&ss->sibling);
  729 + list_move(&ss->sibling, &rootnode.subsys_list);
730 730 } else if (bit & final_bits) {
731 731 /* Subsystem state should already exist */
732 732 BUG_ON(!cgrp->subsys[i]);
... ... @@ -2521,6 +2521,7 @@
2521 2521 printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name);
2522 2522  
2523 2523 /* Create the top cgroup state for this subsystem */
  2524 + list_add(&ss->sibling, &rootnode.subsys_list);
2524 2525 ss->root = &rootnode;
2525 2526 css = ss->create(ss, dummytop);
2526 2527 /* We don't handle early failures gracefully */