Product SiteDocumentation Site

2.5. Creating Control Groups

Use the cgcreate command to create cgroups. The syntax for cgcreate is: cgcreate -t uid:gid -a uid:gid -g subsystems:path , where:
Because all cgroups in the same hierarchy have the same controllers, the child group has the same controllers as its parent.
Example 2.5. cgcreate usage
Consider a system where the cpu and memory subsystems are mounted together in the cpu_and_mem hierarchy, and the net_cls controller is mounted in a separate hierarchy called net. We now run:
~]# cgcreate -g cpu,net_cls:/test-subgroup
The cgcreate command creates two groups named test-subgroup, one in the cpu_and_mem hierarchy and one in the net hierarchy. The test-subgroup group in the cpu_and_mem hierarchy is controlled by the memory subsystem, even though we did not specify it in the cgcreate command.

Alternative method

To create a child of the cgroup directly, use the mkdir command:
~]# mkdir /cgroup/hierarchy/name/child_name
For example:
~]# mkdir /cgroup/cpuset/lab1/group1