]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxset: add -R option to recursively set variables
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sun, 30 Jun 2024 02:21:02 +0000 (07:51 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 17 Jul 2024 21:14:33 +0000 (15:14 -0600)
commit34cf2cf4fb047adaca50e71be2dc4330dd4d2184
tree6beff65fb2cef47ed259e5843d23f010454b2701
parent6470e0030866dfc71abc801a5d4dd8973ce28226
tools/cgxset: 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
------------------
./cgxset -2 -r cpu.weight=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
--------------
./cgxset -R -2 -r cpu.weight=50 foo
./cgget -r cpu.shares foo foo/ch1 foo/ch2
foo:
cpu.shares: 512

foo/ch1:
cpu.shares: 512

foo/ch2:
cpu.shares: 512

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