]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api: cgroup v2 – enable controller at the leaf node
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 20 Dec 2022 16:09:02 +0000 (21:39 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 6 Jan 2023 15:07:14 +0000 (08:07 -0700)
commitbb291add5db87fe36a82a18c6eb6aaf64dc07694
tree7c1e1ee879a23345998aaeb26678a05f9b7af87b
parentddfc298084c262c2f370fae74ea01cb3deefff65
api: cgroup v2 – enable controller at the leaf node

With cgroup v2, while creating a cgroup with a controller, the whole
hierarchy tree is walked, and the controller is enabled up to the parent
cgroup of the leaf node, this guarantees that the attached controller is
available in the leaf cgroups cgroup.controllers file, but this is
incomplete because the controller is not enabled in the leaf cgroup.

We do not have a separate API that is called to enable the controllers
but as a workaround, one can always call the
cgroup_set_values_recursive() to enable the controller in the leaf node.
To maintain the idea/compatibility with the cgroup v1, where creating a
cgroup on the controller mount point/hierarchy is equivalent to enabling
the controller in the cgroup v2, let's enable the controller in the leaf
node too.

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