]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgset: add -R option to recursively set variables
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Mon, 9 Oct 2023 11:00:10 +0000 (16:30 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 1 Nov 2023 14:59:13 +0000 (08:59 -0600)
commit51dd13ed8a3db09dddceeae8097758d801473ec5
treedc4faccd16ce4bd8aa1cb3f78e0a74be68307c7e
parent87997ed35f02f42d3d6488beeb23f1b9ee6701d0
tools/cgset: add -R option to recursively set variables

Add -R option to recursively set variable(s) passed to cgroups under
<cgroup_path>. This will help users to set a controller setting for
all the cgroups under a cgroup hierarchy, instead of passing the
cgroups multiple times on the command line.

example:
--------
./cgcreate -gcpu,memory:foo -gcpu:memory:foo/ch1 -gcpu,memory:foo/ch2
./cgget -r cpu.shares foo foo/ch1 foo/ch2
foo:
cpu.shares: 1024

foo/ch1:
cpu.shares: 1024

foo/ch2:
cpu.shares: 1024

Without the patch
------------------
./cgset -r cpu.shares=256 foo
./cgget -r cpu.shares foo
foo/ch1 foo/ch2
foo:
cpu.shares: 256

foo/ch1:
cpu.shares: 1024

foo/ch2:
cpu.shares: 1024

With the patch
--------------
./cgset -R -r cpu.shares=512 foo
./cgget  -r cpu.shares foo foo/ch1 foo/ch2
foo:
cpu.shares: 512

foo/ch1:
cpu.shares: 512

foo/ch2:
cpu.shares: 512

[check for ECGEOF recommend by Tom Hromatka]
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgset.c