Bug 15980

Summary: Problems with cgroup inheritance
Product: Process Management Reporter: Pavel Odintsov (pavel.odintsov)
Component: OtherAssignee: process_other
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, kernel
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 2.6.33.4 Subsystem:
Regression: No Bisected commit-id:

Description Pavel Odintsov 2010-05-15 23:17:32 UTC
I have following cgroups configuration:
hosting /mnt/cgroup cgroup memory,cpu,cpuacct,blkio 0 0

It already mounted:
mount | grep cgr
hosting on /mnt/cgroup type cgroup (rw,memory,cpu,cpuacct,blkio)

And consist following groups:
ls -l /mnt/cgroup/
total 0
-r--r--r-- 1 root root 0 2010-05-16 02:19 blkio.sectors
-r--r--r-- 1 root root 0 2010-05-16 02:19 blkio.time
-rw-r--r-- 1 root root 0 2010-05-16 02:19 blkio.weight
-r--r--r-- 1 root root 0 2010-05-16 02:19 cgroup.procs
-r--r--r-- 1 root root 0 2010-05-16 02:19 cpuacct.stat
-rw-r--r-- 1 root root 0 2010-05-16 02:19 cpuacct.usage
-r--r--r-- 1 root root 0 2010-05-16 02:19 cpuacct.usage_percpu
-rw-r--r-- 1 root root 0 2010-05-16 02:19 cpu.shares
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.failcnt
--w------- 1 root root 0 2010-05-16 02:19 memory.force_empty
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.limit_in_bytes
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.max_usage_in_bytes
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.memsw.failcnt
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.memsw.limit_in_bytes
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.memsw.max_usage_in_bytes
-r--r--r-- 1 root root 0 2010-05-16 02:19 memory.memsw.usage_in_bytes
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.soft_limit_in_bytes
-r--r--r-- 1 root root 0 2010-05-16 02:19 memory.stat
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.swappiness
-r--r--r-- 1 root root 0 2010-05-16 02:19 memory.usage_in_bytes
-rw-r--r-- 1 root root 0 2010-05-16 02:19 memory.use_hierarchy
-rw-r--r-- 1 root root 0 2010-05-16 02:19 notify_on_release
-rw-r--r-- 1 root root 0 2010-05-16 02:19 release_agent
-rw-r--r-- 1 root root 0 2010-05-16 02:19 tasks

drwxr-xr-x 2 root root 0 2010-05-16 02:19 v001001
drwxr-xr-x 2 root root 0 2010-05-16 02:19 v001002
drwxr-xr-x 2 root root 0 2010-05-16 02:19 v001003

But when I try create new subcgroup in our cgroup /mnt/cgroup/v001001, i get error:
cd /mnt/cgroup/v001001/; mkdir subcgroup
mkdir: cannot create directory `subcgroup': Invalid argument 

But in Documentation/cgroups/cgroups.txt:
You can also create cgroups inside your cgroup by using mkdir in this directory.
# mkdir my_sub_cs

Its bug?
Comment 1 Florian Philipp 2010-12-05 16:18:27 UTC
I experience the same issue. It seems to be related to the blkio subsystem. If I mount only with "-o cpu", everything works as expected. I haven't tried the other subsystems, though.

I'm using a 2.6.34 kernel.
Comment 2 Florian Philipp 2010-12-05 19:15:53 UTC
The reason seems to be this:
http://lwn.net/Articles/413015/

Basically, memory and blkio subsystems do not support hierarchies. Therefore they disallow their creation. The proposed patch (which will be included into 2.6.38 according to this: http://thread.gmane.org/gmane.linux.kernel/1057268) will support hierarchies but basically transforms them back into a flat hierarchy.

That should solve all issues described in this ticket.