]> 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:33:52 +0000 (12:33 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 27 Jan 2022 19:46:42 +0000 (12:46 -0700)
commit4c577f91050b1ad00e5ed2b2abb40fc4978db996
tree5ee3fa518449000d13192abe0f1552d7cc0f8b50
parent8a9c189df642737770a09ba9acad129cd196d7aa
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>
src/api.c