Linux command
cgset 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Set CPU quota
cgset -r cpu.cfs_quota_us=[50000] [/mygroup]
Set memory limit
cgset -r memory.limit_in_bytes=[512M] [/mygroup]
Set multiple parameters
cgset -r cpu.shares=[512] -r memory.limit_in_bytes=[1G] [/mygroup]
Copy settings
cgset --copy-from [/source_group] [/dest_group]
说明
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.
参数
- -r _name=value_
- Set a parameter to a value.
- --copy-from _cgroup_
- Copy parameters from another cgroup.
- -h, --help
- Display help information.
FAQ
What is the cgset command used for?
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.
How do I run a basic cgset example?
Run `cgset -r cpu.cfs_quota_us=[50000] [/mygroup]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r _name=value_ do in cgset?
Set a parameter to a value.