2.11. Obtaining Information About Control Groups

There are several ways to find and monitor control groups, subsystems, and hierarchies configured on your system.

2.11.1. Finding a Process

To find the cgroup to which a process belongs, run:
~]$ ps -O cgroup
Or, if you know the PID for the process, run:
~]$ cat /proc/PID/cgroup
where PID stands for a PID of the inspected process.

2.11.2. Finding a Subsystem

To find out what subsystems are available in your kernel and how they are mounted together into hierarchies, run:
~]$ cat /proc/cgroups
#subsys_name    hierarchy       num_cgroups     enabled
cpuset  2       1       1
ns      0       1       1
cpu     3       1       1
cpuacct 4       1       1
memory  5       1       1
devices 6       1       1
freezer 7       1       1
net_cls 8       1       1
blkio   9       3       1
perf_event      0       1       1
net_prio        0       1       1
In the example output above, the hierarchy column lists IDs of the existing hierarchies on the system. Subsystems with the same hierarchy ID are attached to the same hierarchy. The num_cgroup column lists the number of existing cgroups in the hierarchy that uses a particular subsystem. The enabled column reports the value of 1 if a particular subsystem is enabled, or 0 if it is not.
Or, to find the mount points of particular subsystems, run:
~]$ lssubsys -m subsystems
where subsystems is a list of the subsystems in which you are interested. Note that the lssubsys -m command returns only the top-level mount point per each hierarchy.

2.11.3. Finding Hierarchies

It is recommended that you mount hierarchies under the /cgroup/ directory. Assuming this is the case on your system, list or browse the contents of that directory to obtain a list of hierarchies. If the tree utility is installed on your system, run it to obtain an overview of all hierarchies and the cgroups within them:
~]$ tree /cgroup

2.11.4. Finding Control Groups

To list the cgroups on a system, run:
~]$ lscgroup
You can restrict the output to a specific hierarchy by specifying a controller and path in the format controller:path. For example:
~]$ lscgroup cpuset:group1
lists only subgroups of the group1 cgroup in the hierarchy to which the cpuset subsystem is attached.

2.11.5. Displaying Parameters of Control Groups

To display the parameters of specific cgroups, run:
~]$ cgget -r parameter list_of_cgroups
where parameter is a pseudofile that contains values for a subsystem, and list_of_cgroups is a list of cgroups separated with spaces. For example:
~]$ cgget -r cpuset.cpus -r memory.limit_in_bytes group1 group2
displays the values of cpuset.cpus and memory.limit_in_bytes for cgroups group1 and group2.
If you do not know the names of the parameters themselves, use a command like:
~]$ cgget -g cpuset /