]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: add support for cgroup.threads
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 27 Jan 2022 19:47:55 +0000 (12:47 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 27 Jan 2022 19:48:11 +0000 (12:48 -0700)
commitd085455befc3d291064d1438cd4614e1245546a3
treeda65e3fd112e44e725764f0ed40d48e50a86889d
parent27037a4415ae25997264196d1137c8b66eaa0f96
api.c: add support for cgroup.threads

cgroup_build_tasks_procs_path(), that builds the proc path for moving
the tid, doesn't check for the cgroup type and appends cgroup.procs for
both cgroup v1/v2.  With cgroup v2, this results in building a wrong
proc path if the cgroup type is threaded. This patch adds support to
check for the cgroup v2 type and build the proc path according to the
below table:

cgroup.type     | proc file      | Description                        |
----------------+----------------+------------------------------------+
domain          | cgroup.procs   | regular cgroup, all threads gets   |
                |                | moved to the cgroup.               |
domain threaded | cgroup.procs   | root of threaded subtree, all      |
                |                | threads gets moved to the cgroup.  |
threaded        | cgroup.threads | cgroup under threaded subtree,     |
|  | single threads with matching tid,  |
|  | gets moved to the cgroup.          |
domain invalid  | N/A            | invalid state of a cgroup under the|
                |                | threaded subtree.                  |

Closes: https://github.com/libcgroup/libcgroup/issues/64
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
cherry picked from commit 4c577f91050b1ad00e5ed2b2abb40fc4978db996)
src/api.c