Revision 94b3dd0f7bb393d93e84a173b1df9b8b64c83ac4 authored by Greg Thelen on 04 June 2010, 21:15:03 UTC, committed by Linus Torvalds on 04 June 2010, 22:21:45 UTC
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

Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Paul Menage <menage@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: <stable@kernel.org>		[2.6.34.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 007d086
History
File Mode Size
Kconfig -rw-r--r-- 1.5 KB
Makefile -rw-r--r-- 323 bytes
acl.c -rw-r--r-- 7.0 KB
acl.h -rw-r--r-- 831 bytes
aops.c -rw-r--r-- 30.1 KB
bmap.c -rw-r--r-- 31.3 KB
bmap.h -rw-r--r-- 1.7 KB
dentry.c -rw-r--r-- 2.7 KB
dir.c -rw-r--r-- 46.5 KB
dir.h -rw-r--r-- 2.1 KB
export.c -rw-r--r-- 5.8 KB
file.c -rw-r--r-- 19.4 KB
gfs2.h -rw-r--r-- 524 bytes
glock.c -rw-r--r-- 46.2 KB
glock.h -rw-r--r-- 7.3 KB
glops.c -rw-r--r-- 11.3 KB
glops.h -rw-r--r-- 1.0 KB
incore.h -rw-r--r-- 16.2 KB
inode.c -rw-r--r-- 26.3 KB
inode.h -rw-r--r-- 4.2 KB
lock_dlm.c -rw-r--r-- 5.4 KB
log.c -rw-r--r-- 24.0 KB
log.h -rw-r--r-- 1.8 KB
lops.c -rw-r--r-- 18.9 KB
lops.h -rw-r--r-- 2.9 KB
main.c -rw-r--r-- 4.8 KB
meta_io.c -rw-r--r-- 10.2 KB
meta_io.h -rw-r--r-- 2.5 KB
ops_fstype.c -rw-r--r-- 35.5 KB
ops_inode.c -rw-r--r-- 30.4 KB
quota.c -rw-r--r-- 37.7 KB
quota.h -rw-r--r-- 1.8 KB
recovery.c -rw-r--r-- 14.3 KB
recovery.h -rw-r--r-- 1.1 KB
rgrp.c -rw-r--r-- 46.2 KB
rgrp.h -rw-r--r-- 2.5 KB
super.c -rw-r--r-- 33.2 KB
super.h -rw-r--r-- 2.0 KB
sys.c -rw-r--r-- 14.5 KB
sys.h -rw-r--r-- 600 bytes
trace_gfs2.h -rw-r--r-- 10.6 KB
trans.c -rw-r--r-- 4.6 KB
trans.h -rw-r--r-- 1.1 KB
util.c -rw-r--r-- 8.0 KB
util.h -rw-r--r-- 5.0 KB
xattr.c -rw-r--r-- 33.4 KB
xattr.h -rw-r--r-- 2.1 KB

back to top