* [PATCH cgroup/for-3.11] cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy
@ 2013-06-22 16:30 Tejun Heo
[not found] ` <20130622163041.GA15261-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2013-06-22 16:30 UTC (permalink / raw)
To: Li Zefan
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
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.
Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
kernel/cgroup.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1421,14 +1421,15 @@ static void init_cgroup_root(struct cgro
init_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(struc
if (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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH cgroup/for-3.11] cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy
[not found] ` <20130622163041.GA15261-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
@ 2013-06-25 1:38 ` Li Zefan
2013-06-25 18:44 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Li Zefan @ 2013-06-25 1:38 UTC (permalink / raw)
To: Tejun Heo
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
On 2013/6/23 0:30, Tejun Heo wrote:
> 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.
>
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> kernel/cgroup.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH cgroup/for-3.11] cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy
[not found] ` <20130622163041.GA15261-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-25 1:38 ` Li Zefan
@ 2013-06-25 18:44 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2013-06-25 18:44 UTC (permalink / raw)
To: Li Zefan
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
On Sat, Jun 22, 2013 at 09:30:41AM -0700, Tejun Heo wrote:
> 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.
>
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Applied to cgroup/for-3.11.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-25 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 16:30 [PATCH cgroup/for-3.11] cgroup: reserve ID 0 for dummy_root and 1 for unified hierarchy Tejun Heo
[not found] ` <20130622163041.GA15261-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-25 1:38 ` Li Zefan
2013-06-25 18:44 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.