cgroup: alloc_css_id() increments hierarchy depth
PATCH 1/1 cgroup: alloc_css_id() increments hierarchy depth
Child groups should have a greater depth than their parents. Prior to this change, the parent would incorrectly report zero memory usage for child cgroups when use_hierarchy is enabled.
test script:
mount -t cgroup none /cgroups -o memory
cd /cgroups
mkdir cg1
echo 1 > cg1/memory.use_hierarchy
mkdir cg1/cg11
echo $$ > cg1/cg11/tasks
dd if=/dev/zero of=/tmp/foo bs=1M count=1
echo
echo CHILD
grep cache cg1/cg11/memory.stat
echo
echo PARENT
grep cache cg1/memory.stat
echo $$ > tasks
rmdir cg1/cg11 cg1
cd /
umount /cgroups
Using fae9c79, a recent patch that changed alloc_css_id() depth computation, the parent incorrectly reports zero usage:
root@ubuntu:~# ./test 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0151844 s, 69.1 MB/s
CHILD
cache 1048576
total_cache 1048576
PARENT
cache 0
total_cache 0
With this patch, the parent correctly includes child usage:
root@ubuntu:~# ./test 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0136827 s, 76.6 MB/s
CHILD
cache 1052672
total_cache 1052672
PARENT
cache 0
total_cache 1052672
--- kernel/cgroup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/cgroup.c +1 -1
@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, parent_css = parent->subsys[subsys_id]; child_css = child->subsys[subsys_id]; parent_id = parent_css->id; - depth = parent_id->depth; + depth = parent_id->depth +1 ; child_id =get_new_cssid (ss, depth);if (IS_ERR (child_id))
Signature · 1 line
1.7.0.1
A message that is not in the archive (sent off-list or not yet received): 1275059781-9831-1-git-send-email-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
Paul Menage
Acked-byQuoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>
Good catch, thanks.
Paul
Quoted 21 lines
---
kernel/cgroup.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)kernel/cgroup.c +1
-2@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, parent_css = parent->subsys[subsys_id]; child_css = child->subsys[subsys_id]; parent_id = parent_css->id; - depth = parent_id->depth; + depth = parent_id->depth + 1; child_id = get_new_cssid(ss, depth); if (IS_ERR(child_id)) --1.7.0.1
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>
Good catch, thanks.
Paul
Quoted 21 lines
---
kernel/cgroup.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)kernel/cgroup.c +1
-2@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, parent_css = parent->subsys[subsys_id]; child_css = child->subsys[subsys_id]; parent_id = parent_css->id; - depth = parent_id->depth; + depth = parent_id->depth + 1; child_id = get_new_cssid(ss, depth); if (IS_ERR(child_id)) --1.7.0.1
A message that is not in the archive (sent off-list or not yet received): AANLkTino0k-wok9kXLmWTyr40dZKSCnR0Uk41uxAj5k1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
KAMEZAWA Hiroyuki
Acked-byQuoted 8 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
2.6.33 has this.
Quoted 4 lines
3959 depth =
css_depth(parent_css)+ 1;
3960parent_id=parent_css->id;
3961
3962child_id=get_new_cssid(ss, depth);
Thanks,
-Kame
Quoted 17 lines
Paul
Quoted 15 lines
---
kernel/cgroup.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)kernel/cgroup.c +1
-1@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, parent_css = parent->subsys[subsys_id]; child_css = child->subsys[subsys_id]; parent_id = parent_css->id; - depth = parent_id->depth; + depth = parent_id->depth + 1;
Quoted 7 lines
Quoted 6 lines
kernel/cgroup.c +0
-1child_id = get_new_cssid(ss, depth); if (IS_ERR(child_id)) --1.7.0.1
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers
KAMEZAWA Hiroyuki
Acked-byQuoted 8 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
2.6.33 has this.
Quoted 4 lines
3959 depth =
css_depth(parent_css)+ 1;
3960parent_id=parent_css->id;
3961
3962child_id=get_new_cssid(ss, depth);
Thanks,
-Kame
Quoted 24 lines
Paul
Quoted 21 lines
---
kernel/cgroup.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)kernel/cgroup.c +1
-2@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, parent_css = parent->subsys[subsys_id]; child_css = child->subsys[subsys_id]; parent_id = parent_css->id; - depth = parent_id->depth; + depth = parent_id->depth + 1; child_id = get_new_cssid(ss, depth); if (IS_ERR(child_id)) --1.7.0.1
A message that is not in the archive (sent off-list or not yet received): 20100531084529.2b1f0d25.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org
Quoted 7 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 4 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage…
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>
Quoted 9 lines
Quoted 4 lines
Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Thanks,
-Kame
Quoted 7 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 4 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>
Quoted 9 lines
Quoted 4 lines
Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Thanks,
-Kame
Quoted 17 lines · KAMEZAWA Hiroyuki
Quoted 14 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 8 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
Quoted 6 lines
Quoted 2 lines
But, who breaks this ? Do we need backport this against old kernels ?
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
--
Greg
A message that is not in the archive (sent off-list or not yet received): AANLkTilNrrsNluDBUlXCsZMz7d_-VHn31Ogvkw9AUPnE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 23 lines · On Sun, 30 May 2010 17:44:34 -0700 Greg Thelen…
Quoted 21 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 4 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage…
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Quoted 9 lines
Quoted 4 lines
Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Quoted 8 lines
Quoted 2 lines
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me
to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
Yes, it's best to CC [email protected] But please specify what version of kernels requires this patch as "for 2.6.34"
Thank you,
-Kame
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
Quoted 6 lines · Greg Thelen
Quoted 1 line
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Quoted 8 lines
Quoted 2 lines
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me
to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
I think Andrew will mark it and send it to stable.
Quoted 23 lines · On Sun, 30 May 2010 17:44:34 -0700 Greg Thelen <[email protected]> wrote:
Quoted 21 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 4 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Quoted 9 lines
Quoted 4 lines
Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Quoted 8 lines
Quoted 2 lines
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
Yes, it's best to CC [email protected]. But please specify what version of kernels requires this patch as "for 2.6.34"
Thank you,
-Kame
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
Quoted 6 lines · Greg Thelen
Quoted 1 line
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Quoted 8 lines
Quoted 2 lines
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
I think Andrew will mark it and send it to stable.
A message that is not in the archive (sent off-list or not yet received): 20100531085431.a45b30b9.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org
Quoted 17 lines · KAMEZAWA Hiroyuki
Quoted 14 lines · On Mon, 31 May 2010 08:45:29 +0900 KAMEZAWA Hiroyuki…
Quoted 8 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage…
Quoted 2 lines · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
Quoted 6 lines
Quoted 2 lines
But, who breaks this ? Do we need backport this against old kernels ?
Hmm. this one. and 2.6.34 needs this patch. Greg, could you post this to stable-2.6.34 tree ?
Given that I forgot to include "Cc: stable <[email protected]>" in the patch, I assume the best way to get this patch into -stable is for me
to email the commit id to [email protected] once the patch is accepted into Linus' tree. Let me know if there is a better way.
--
Greg
Li Zefan
Acked-byQuoted 5 lines · KAMEZAWA Hiroyuki
Quoted 2 lines · On Fri, 28 May 2010 15:25:08 -0700 Paul Menage <[email protected]> wrote:
Quoted 1 line · Greg Thelen
Signed-off-by Greg Thelen <[email protected]>
Quoted 9 lines
Quoted 4 lines
Acked-by Paul Menage <[email protected]>Good catch, thanks.
Nice Catch.
But, who breaks this ? Do we need backport this against old kernels ?
Oops, I broke it, and it needs to be backported to 2.6.34.. Thanks for catching this!