cgclassify
Move processes into cgroups
TLDR
Move the process with a specific PID to the control [g]roup student in the CPU hierarchy
Move the process with a specific PID to control groups based on the /etc/cgrules.conf configuration file
Move the process with a specific PID to the control [g]roup student in the CPU hierarchy. Note: The daemon of the service cgred does not change cgroups of the specific PID and its children (based on /etc/cgrules.conf)
SYNOPSIS
cgclassify [-g controllers[:path]] [-u] [-d] [-s] [-1] pidlist
PARAMETERS
-g controllers[:path]
Move tasks to cgroup at path for comma-separated controllers; creates if missing
-u
Use cgroup filesystem path from command line (mutually exclusive with -g)
-d
Move to default cgroup for each hierarchy
-s
Move to task's current cgroup for specified controllers (sticky)
-1
Use first controller in list for path resolution
--help
Display usage information
--version
Show version
DESCRIPTION
The cgclassify command is a utility from the libcgroup package designed to dynamically move running processes (tasks) into specified control groups (cgroups) on Linux systems using cgroups v1. Cgroups enable resource management, limiting CPU, memory, I/O, and other limits for process groups.
By default, it creates the target cgroup if it does not exist. This is useful for runtime classification without process restart, such as prioritizing workloads or isolating services. It operates on cgroup hierarchies, supporting multiple controllers like cpu, memory, blkio.
Specify target via controller:path or filesystem path. Options allow moving to defaults, sticky cgroups (from task's current), or root groups. Requires privileges like CAP_SYS_ADMIN or cgroup.procs write access.
Common use: classify processes by PID list into a cgroup for resource control. Deprecated in modern systems favoring cgroups v2 and systemd, but valuable for legacy setups or custom hierarchies.
Integrates with tools like cgcreate for setup. Output shows success/failure per PID.
CAVEATS
Requires root or CAP_SYS_ADMIN; cgroups v1 only (not v2); may fail if cgroup frozen or task unmovable; check /proc/pid/cgroup post-move.
EXAMPLES
cgclassify -g cpu,memory:/production 1234 5678
Moves PIDs 1234,5678 to cpu/memory cgroup at /production.
cgclassify -d 9999
Moves PID 9999 to defaults.
HISTORY
Part of libcgroup project (2007+), developed for early cgroups v1 by Red Hat/IBM; peaked in RHEL6/CentOS6 era; largely superseded by systemd (v2) since kernel 4.5 (2016).
SEE ALSO
cgcreate(1), cgexec(1), cgset(1), cgrulesengd(8), systemd-cgtop(8)


