LinuxCommandLibrary

cgset

set cgroup parameters

TLDR

Set CPU quota for a cgroup

$ cgset -r cpu.cfs_quota_us=[50000] [/mygroup]
copy
Set memory limit for a cgroup
$ cgset -r memory.limit_in_bytes=[512M] [/mygroup]
copy
Set multiple parameters at once
$ cgset -r cpu.shares=[512] -r memory.limit_in_bytes=[1G] [/mygroup]
copy
Copy settings from one cgroup to another
$ cgset --copy-from [/source_group] [/dest_group]
copy

SYNOPSIS

cgset [-r name=value]... cgroup
cgset --copy-from source destination

DESCRIPTION

cgset modifies parameters of existing control groups (cgroups). It allows setting resource limits and controls for CPU, memory, I/O, and other subsystems on groups of processes.
Common parameters include CPU shares (relative priority), CPU quotas (hard limits), memory limits, and I/O weights. The available parameters depend on which controllers are mounted and the cgroup version.
cgset is part of libcgroup-tools for managing cgroups v1. For cgroups v2, systemd or direct filesystem writes are typically used instead.

PARAMETERS

-r name=value

Set a parameter to a value.
--copy-from cgroup
Copy parameters from another cgroup.
-h, --help
Display help information.

CAVEATS

Requires appropriate permissions (typically root). Parameter names and values are controller-specific. Invalid values may be rejected by the kernel. Only works with cgroups v1 hierarchy. Some parameters cannot be changed while processes are in the cgroup.

HISTORY

cgset is part of libcgroup, developed by Red Hat starting around 2008 to provide user-space cgroup management. The tool provided a way to configure resource limits without direct filesystem manipulation. As cgroups v2 and systemd became prevalent, direct management through these tools became less common.

SEE ALSO

cgcreate(1), cgdelete(1), cgget(1), cgexec(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community