History

cgroup: build list of all cgroups under a given cgroupfs_root

Build a list of all cgroups anchored at cgroupfs_root->allcg_list and going through cgroup->allcg_node. The list is protected by cgroup_mutex and will be used to improve cgroup file handling.

Tejun Heo committed 14 years ago

Commit b0ca5a81 parent ff4c8d52 files · +12 −0Browse files

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

kernel/cgroup.c+10−0
@@ -127,6 +127,9 @@ struct cgroupfs_root { · 126 unmodified lines
127 /* A list running through the active hierarchies */127 /* A list running through the active hierarchies */
128 struct list_head root_list;128 struct list_head root_list;
129 129
130 /* All cgroups on this root, cgroup_mutex protected */
131 struct list_head allcg_list;
132
130 /* Hierarchy-specific flags */133 /* Hierarchy-specific flags */
131 unsigned long flags;134 unsigned long flags;
132 135
@@ -1350,11 +1353,14 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp) · 1217 unmodified lines
1350static void init_cgroup_root(struct cgroupfs_root *root)1353static void init_cgroup_root(struct cgroupfs_root *root)
1351{1354{
1352 struct cgroup *cgrp = &root->top_cgroup;1355 struct cgroup *cgrp = &root->top_cgroup;
1356
1353 INIT_LIST_HEAD(&root->subsys_list);1357 INIT_LIST_HEAD(&root->subsys_list);
1354 INIT_LIST_HEAD(&root->root_list);1358 INIT_LIST_HEAD(&root->root_list);
1359 INIT_LIST_HEAD(&root->allcg_list);
1355 root->number_of_cgroups = 1;1360 root->number_of_cgroups = 1;
1356 cgrp->root = root;1361 cgrp->root = root;
1357 cgrp->top_cgroup = cgrp;1362 cgrp->top_cgroup = cgrp;
1363 list_add_tail(&cgrp->allcg_node, &root->allcg_list);
1358 init_cgroup_housekeeping(cgrp);1364 init_cgroup_housekeeping(cgrp);
1359}1365}
1360 1366
@@ -3790,6 +3796,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, · 2429 unmodified lines
3790 /* The cgroup directory was pre-locked for us */3796 /* The cgroup directory was pre-locked for us */
3791 BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex));3797 BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex));
3792 3798
3799 list_add_tail(&cgrp->allcg_node, &root->allcg_list);
3800
3793 err = cgroup_populate_dir(cgrp);3801 err = cgroup_populate_dir(cgrp);
3794 /* If err < 0, we have a half-filled directory - oh well ;) */3802 /* If err < 0, we have a half-filled directory - oh well ;) */
3795 3803
@@ -3998,6 +4006,8 @@ again: · 202 unmodified lines
3998 list_del_init(&cgrp->sibling);4006 list_del_init(&cgrp->sibling);
3999 cgroup_unlock_hierarchy(cgrp->root);4007 cgroup_unlock_hierarchy(cgrp->root);
4000 4008
4009 list_del_init(&cgrp->allcg_node);
4010
4001 d = dget(cgrp->dentry);4011 d = dget(cgrp->dentry);
4002 4012
4003 cgroup_d_remove_dir(d);4013 cgroup_d_remove_dir(d);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t