summaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-02-12 09:29:50 -0500
committerTejun Heo <tj@kernel.org>2014-02-12 09:29:50 -0500
commit3c9c825b8b50de7dbb015e6bfc04bb2da79364d9 (patch)
treed12fdc2cc0c232e07f1cccb1f72435210e18075e /include/linux/cgroup.h
parente61734c55c24cdf11b07e52a74aec4dc4a7f4bd0 (diff)
downloadtalos-op-linux-3c9c825b8b50de7dbb015e6bfc04bb2da79364d9.tar.gz
talos-op-linux-3c9c825b8b50de7dbb015e6bfc04bb2da79364d9.zip
cgroup: rename cgroupfs_root->number_of_cgroups to ->nr_cgrps and make it atomic_t
root->number_of_cgroups is currently an integer protected with cgroup_mutex. Except for sanity checks and proc reporting, the only place it's used is to check whether the root has any child during remount; however, this is a bit flawed as the counter is not decremented when the cgroup is unlinked but when it's released, meaning that there could be an extended period where all cgroups are removed but remount is still not allowed because some internal objects are lingering. While not perfect either, it'd be better to use emptiness test on root->top_cgroup.children. This patch updates cgroup_remount() to test top_cgroup's children instead, which makes number_of_cgroups only actual usage statistics printing in proc implemented in proc_cgroupstats_show(). Let's shorten its name and make it an atomic_t so that we don't have to worry about its synchronization. It's purely auxiliary at this point. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 4d6ff7d40cf6..f0e6105bbbc1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -290,8 +290,8 @@ struct cgroupfs_root {
/* The root cgroup for this hierarchy */
struct cgroup top_cgroup;
- /* Tracks how many cgroups are currently defined in hierarchy.*/
- int number_of_cgroups;
+ /* Number of cgroups in the hierarchy, used only for /proc/cgroups */
+ atomic_t nr_cgrps;
/* A list running through the active hierarchies */
struct list_head root_list;
OpenPOWER on IntegriCloud