]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxset add support for default systemd delegation slice/scope
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 3 Feb 2023 08:22:15 +0000 (08:22 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 10 Feb 2023 21:44:25 +0000 (14:44 -0700)
commita3fae4de61bc64d499e5a288a0e853b73475684c
treed453ac743c95755954e576a2a6a73053b3bd561d
parent36ed9afee2dfbd6b5e16df6d5f37cd05bb44eecb
tools/cgxset add support for default systemd delegation slice/scope

Enhance the cgxset tool to support default systemd delegation slice/scope,
if set in the cgconfig.conf's systemd setting.  Parse the configuration
file and read the systemd::delegate setting, if any, and set it as
the default systemd slice/scope in systemd_default_cgroup.
Setting it appends the slice/scope name to the constructed default cgroup
mount path.

When the user passes the relative cgroup name, its appends to the
sub-tree (delegated slice/scope) by default and if the user wishes to set
controller::value in a cgroup under another subtree or cgroup root
hierarchy, they need to use the absolute path. For example:
  cgroup_root
 /     \
/      \
 systemd.slice*      cgrp1
|
 systemd.scope
|
    cgrp-d1

* default system delegation slice/scope - read from cgconfig.conf

$ sudo ./src/tools/cgxset 1 -r cpu.weight=99 cgrp-d1

will set the cpu controller:cpu.weight information under the
cgroup_root:systemd_default_cgroup:cgrp-d1

and for setting the cpu controller information of cgrp1, the user can
use:
$ sudo ./src/tools/cgxset -r cpu.weight=99 /cgrp1

or use the newly introduced -b switch to ignore the systemd
slice/scope:
$ sudo ./src/tools/cgxset -b -r cpu.weight=99 cgrp1

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgxset.c