static struct cgroup_name root_cgroup_name = { .name = "/" };
+/*
+ * Assign a monotonically increasing serial number to cgroups. It
+ * guarantees cgroups with bigger numbers are newer than those with smaller
+ * numbers. Also, as cgroups are always appended to the parent's
+ * ->children list, it guarantees that sibling cgroups are always sorted in
+ * the ascending serial number order on the list.
+ */
+static atomic64_t cgroup_serial_nr_cursor = ATOMIC64_INIT(0);
+
/* This flag indicates whether tasks in the fork and exit paths should
* check for fork/exit handlers to call. This avoids us having to do
* extra work in the fork/exit path if none of the subsystems need to
static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
umode_t mode)
{
- static atomic64_t serial_nr_cursor = ATOMIC64_INIT(0);
struct cgroup *cgrp;
struct cgroup_name *name;
struct cgroupfs_root *root = parent->root;
goto err_free_all;
lockdep_assert_held(&dentry->d_inode->i_mutex);
- /*
- * Assign a monotonically increasing serial number. With the list
- * appending below, it guarantees that sibling cgroups are always
- * sorted in the ascending serial number order on the parent's
- * ->children.
- */
- cgrp->serial_nr = atomic64_inc_return(&serial_nr_cursor);
+ cgrp->serial_nr = atomic64_inc_return(&cgroup_serial_nr_cursor);
/* allocation complete, commit to creation */
list_add_tail(&cgrp->allcg_node, &root->allcg_list);