Show Table of Contents
3.3. Creating Control Groups
Use the
cgcreate command to create transient cgroups in hierarchies you created yourself. The syntax for cgcreate is:
cgcreate-tuid:gid-auid:gid-gcontrollers:path
where:
-t(optional) — specifies a user (by user ID, uid) and a group (by group ID, gid) to own thetaskspseudo-file for this cgroup. This user can add tasks to the cgroup.Note
Note that the only way to remove a process from a cgroup is to move it to a different cgroup. To be able to move a process, the user has to have write access to the destination cgroup; write access to the source cgroup is not necessary.-a(optional) — specifies a user (by user ID, uid) and a group (by group ID, gid) to own all pseudo-files other thantasksfor this cgroup. This user can modify the access to system resources for tasks in this cgroup.-g— specifies the hierarchy in which the cgroup should be created, as a comma-separated list of the controllers associated with hierarchies. The list of controllers is followed by a colon and the path to the child group relative to the hierarchy. Do not include the hierarchy mount point in the path.
Because all cgroups in the same hierarchy have the same controllers, the child group has the same controllers as its parent.
As an alternative, you can create a child of the cgroup directly. To do so, use the
mkdir command:
~]# mkdir /sys/fs/cgroup/controller/name/child_name
For example:
~]# mkdir /sys/fs/cgroup/net_prio/lab1/group1
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.