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
9p
adfs
affs
afs
autofs
autofs4
befs
bfs
btrfs
cachefiles
ceph
cifs
coda
configfs
cramfs
debugfs
devpts
dlm
ecryptfs
efs
exofs
exportfs
ext2
ext3
ext4
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs
lockd
logfs
minix
ncpfs
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
partitions
proc
qnx4
quota
ramfs
reiserfs
romfs
smbfs
squashfs
sysfs
sysv
ubifs
udf
ufs
xfs
Kconfig -rw-r--r-- 5.4 KB
Kconfig.binfmt -rw-r--r-- 6.4 KB
Makefile -rw-r--r-- 4.1 KB
aio.c -rw-r--r-- 46.1 KB
anon_inodes.c -rw-r--r-- 6.4 KB
attr.c -rw-r--r-- 6.7 KB
bad_inode.c -rw-r--r-- 7.9 KB
binfmt_aout.c -rw-r--r-- 12.5 KB
binfmt_elf.c -rw-r--r-- 53.7 KB
binfmt_elf_fdpic.c -rw-r--r-- 48.7 KB
binfmt_em86.c -rw-r--r-- 2.8 KB
binfmt_flat.c -rw-r--r-- 26.8 KB
binfmt_misc.c -rw-r--r-- 15.1 KB
binfmt_script.c -rw-r--r-- 2.7 KB
binfmt_som.c -rw-r--r-- 7.4 KB
bio-integrity.c -rw-r--r-- 21.0 KB
bio.c -rw-r--r-- 39.2 KB
block_dev.c -rw-r--r-- 41.8 KB
buffer.c -rw-r--r-- 90.5 KB
char_dev.c -rw-r--r-- 13.9 KB
compat.c -rw-r--r-- 56.2 KB
compat_binfmt_elf.c -rw-r--r-- 3.5 KB
compat_ioctl.c -rw-r--r-- 49.1 KB
dcache.c -rw-r--r-- 59.5 KB
dcookies.c -rw-r--r-- 6.8 KB
direct-io.c -rw-r--r-- 36.0 KB
drop_caches.c -rw-r--r-- 1.3 KB
eventfd.c -rw-r--r-- 10.9 KB
eventpoll.c -rw-r--r-- 38.8 KB
exec.c -rw-r--r-- 46.4 KB
fcntl.c -rw-r--r-- 16.9 KB
fifo.c -rw-r--r-- 3.2 KB
file.c -rw-r--r-- 12.1 KB
file_table.c -rw-r--r-- 10.1 KB
filesystems.c -rw-r--r-- 6.3 KB
fs-writeback.c -rw-r--r-- 35.0 KB
fs_struct.c -rw-r--r-- 3.3 KB
generic_acl.c -rw-r--r-- 4.5 KB
inode.c -rw-r--r-- 42.5 KB
internal.h -rw-r--r-- 2.3 KB
ioctl.c -rw-r--r-- 15.9 KB
ioprio.c -rw-r--r-- 5.2 KB
libfs.c -rw-r--r-- 25.4 KB
locks.c -rw-r--r-- 57.7 KB
mbcache.c -rw-r--r-- 18.3 KB
mpage.c -rw-r--r-- 20.0 KB
namei.c -rw-r--r-- 70.6 KB
namespace.c -rw-r--r-- 57.7 KB
nfsctl.c -rw-r--r-- 2.4 KB
no-block.c -rw-r--r-- 663 bytes
open.c -rw-r--r-- 23.6 KB
pipe.c -rw-r--r-- 27.1 KB
pnode.c -rw-r--r-- 9.2 KB
pnode.h -rw-r--r-- 1.1 KB
posix_acl.c -rw-r--r-- 8.4 KB
read_write.c -rw-r--r-- 20.4 KB
read_write.h -rw-r--r-- 542 bytes
readdir.c -rw-r--r-- 6.9 KB
select.c -rw-r--r-- 24.2 KB
seq_file.c -rw-r--r-- 17.9 KB
signalfd.c -rw-r--r-- 7.1 KB
splice.c -rw-r--r-- 47.5 KB
stack.c -rw-r--r-- 2.7 KB
stat.c -rw-r--r-- 10.4 KB
statfs.c -rw-r--r-- 4.2 KB
super.c -rw-r--r-- 24.6 KB
sync.c -rw-r--r-- 10.4 KB
timerfd.c -rw-r--r-- 6.5 KB
utimes.c -rw-r--r-- 5.6 KB
xattr.c -rw-r--r-- 15.6 KB
xattr_acl.c -rw-r--r-- 2.3 KB

back to top