cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy
PATCH 1/1 cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy
Before 1a57423166 ("cgroup: make hierarchy_id use cyclic idr"), hierarchy IDs were allocated from 0. As the dummy hierarchy was always the one first initialized, it got assigned 0 and all other hierarchies from 1. The patch accidentally changed the minimum useable ID to 2.
Let's restore ID 0 for dummy_root and while at it reserve 1 for unified hierarchy.
--- kernel/cgroup.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/cgroup.c +6 -4
@@ -1421,14 +1421,15 @@ static void init_cgroup_root(struct cgroinit_cgroup_housekeeping (cgrp); } -static int cgroup_init_root_id (struct cgroupfs_root *root) +static int cgroup_init_root_id (struct cgroupfs_root *root,int start,int end) {int id;lockdep_assert_held (&cgroup_mutex);lockdep_assert_held (&cgroup_root_mutex); - id =idr_alloc_cyclic (&cgroup_hierarchy_idr, root,2 ,0 ,GFP_KERNEL ); + id =idr_alloc_cyclic (&cgroup_hierarchy_idr, root, start, end, +GFP_KERNEL );if (id <0 )return id;
@@ -1631,7 +1632,8 @@ static struct dentry *cgroup_mount(strucif (ret) goto unlock_drop; - ret =cgroup_init_root_id (root); +/* ID 0 is reserved for dummy root, 1 for unified hierarchy */ + ret =cgroup_init_root_id (root,2 ,0 );if (ret) goto unlock_drop;
@@ -4899,7 +4901,7 @@ int __init cgroup_init(void)mutex_lock (&cgroup_mutex);mutex_lock (&cgroup_root_mutex); -BUG_ON (cgroup_init_root_id (&cgroup_dummy_root)); +BUG_ON (cgroup_init_root_id (&cgroup_dummy_root,0 ,1 ));mutex_unlock (&cgroup_root_mutex);mutex_unlock (&cgroup_mutex);
A message that is not in the archive (sent off-list or not yet received): 20130622163041.GA15261-Gd/HAXX7CRxy/[email protected]
Li Zefan
Acked-byQuoted 6 lines · Tejun Heo
Before
1a57423166("cgroup: makehierarchy_iduse cyclic idr"), hierarchy IDs were allocated from 0. As the dummy hierarchy was always the one first initialized, it got assigned 0 and all other hierarchies from 1. The patch accidentally changed the minimum useable ID to 2.
Quoted 9 lines
Let's restore ID 0 for
dummy_rootand while at it reserve 1 for unified hierarchy.Signed-off-by Tejun Heo <[email protected]>--- kernel/cgroup.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Tejun Heo
AppliedQuoted 11 lines · Tejun Heo
Before
1a57423166("cgroup: makehierarchy_iduse cyclic idr"), hierarchy IDs were allocated from 0. As the dummy hierarchy was always the one first initialized, it got assigned 0 and all other hierarchies from 1. The patch accidentally changed the minimum useable ID to 2.Let's restore ID 0 for
dummy_rootand while at it reserve 1 for unified hierarchy.Signed-off-by Tejun Heo <[email protected]>
Applied to cgroup/for-3.11.
Thanks.
Signature · 1 line
tejun