Linux cgroups: Difference between revisions
Line 15: | Line 15: | ||
cgroups is a Linux kernel feature that allows allocation of resources (CPU, system memory, network bandwidth, or a combination of these) among user-defined ''groups of processes'' running on the system. cgroups not only track groups of processes, but they also expose metrics about CPU, memory and block I/O usage. | cgroups is a Linux kernel feature that allows allocation of resources (CPU, system memory, network bandwidth, or a combination of these) among user-defined ''groups of processes'' running on the system. cgroups not only track groups of processes, but they also expose metrics about CPU, memory and block I/O usage. | ||
cgroups are exposed through a pseudo-filesystem available at /sys/fs/cgroup (older systems expose it at /cgroup). The sub-directories of the cgroup pseudo-filesystem root correspond to different cgroups hierarchies: | cgroups are exposed through a pseudo-filesystem available at /sys/fs/cgroup (older systems expose it at /cgroup). The sub-directories of the cgroup pseudo-filesystem root correspond to different cgroups hierarchies: [[#cpu|cpu]], freezer, blkio. | ||
cgroups are organized hierarchically, child cgroups inheriting certain attributes from their parent group. Many different hierarchies of cgroups can exist simultaneously on a system. Each hierarchy is attached to one or more subsystem, where a subsystem represents a single resource like CPU time or memory. | cgroups are organized hierarchically, child cgroups inheriting certain attributes from their parent group. Many different hierarchies of cgroups can exist simultaneously on a system. Each hierarchy is attached to one or more subsystem, where a subsystem represents a single resource like CPU time or memory. |
Revision as of 20:03, 6 February 2018
External
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/ch01
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/resource_management_guide/chap-introduction_to_control_groups
- https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
- https://en.wikipedia.org/wiki/Cgroups
- http://man7.org/linux/man-pages/man7/cgroups.7.html
Internal
Overview
cgroups is a Linux kernel feature that allows allocation of resources (CPU, system memory, network bandwidth, or a combination of these) among user-defined groups of processes running on the system. cgroups not only track groups of processes, but they also expose metrics about CPU, memory and block I/O usage.
cgroups are exposed through a pseudo-filesystem available at /sys/fs/cgroup (older systems expose it at /cgroup). The sub-directories of the cgroup pseudo-filesystem root correspond to different cgroups hierarchies: cpu, freezer, blkio.
cgroups are organized hierarchically, child cgroups inheriting certain attributes from their parent group. Many different hierarchies of cgroups can exist simultaneously on a system. Each hierarchy is attached to one or more subsystem, where a subsystem represents a single resource like CPU time or memory.
cgroups can be configured via the cgconfig service.
cgroups Subsystems
blkio
Sets limits on input/output access from and to block devices.
cpu
Uses the scheduler to provide cgroup tasks access to the CPU.
cpuacct
Generates automatic reports on CPU resources.
cpuset
Assigns individual CPUs and memory nodes to tasks in a cgroup.
devices
freezer
memory
net_cls
Tags network packets with a tag identifier (classid) that allow the Linux traffic controller (tc) to identify packets.
net_prio
ns
The namespace subsystem.
perf_event
Operations
The recommended location for cgroup hierarchies:
/sys/fs/cgroup