This patchset adds cgroup v2 support to cgexec and cgclassify.

I tested the changes by hand on a cgroup v1 mount, a cgroup v2 mount,
and a system with both cgroup v1 and v2 controllers.  In all of these
cases, cgexec and cgclassify were able to properly assign processes
to the requested cgroup.

There is one corner case that may require additional logic.  The user (me)
requested that a process be added to a v2 cpu cgroup called foo and a v2
memory cgroup called foo2.  Since cgroup v2 shares the same hierarchy,
this request cannot be successfully fulfilled as the process can only
be in foo or foo2.  The code in this patchset moved the process to
foo, then executed the second request and moved it to foo2.  Since the
initial request from the user is invalid, we should catch this within
libcgroup and throw an error.
        sudo ./src/tools/cgclassify -g cpu:foo -g memory:foo2 17186

Since the tests have been split into a separate git repo, those
patches will come out in a separate patchset.

Code is available here:
https://github.com/drakenclimber/libcgroup/commits/wip/cgclassify_v2_v2

Tests are available here:
https://github.com/drakenclimber/libcgroup-tests/tree/issues/cgclassify

Automated test results are here:
https://github.com/drakenclimber/libcgroup/runs/1156216928

Code coverage increased by 0.8% and is now at 21.33%:
https://coveralls.io/builds/33670826

Tom Hromatka (3):
  api.c: Add function to build tasks/procs path
  api.c: Add function to read the cgroup.subtree_control file
  api.c: Verify if a controller is enabled for a v2 cgroup

 src/api.c                | 193 +++++++++++++++++++++++++++++++++++++--
 src/libcgroup-internal.h |  11 +++
 2 files changed, 195 insertions(+), 9 deletions(-)

-- 
2.25.4



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to