for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
if (group->backends[i]) {
- int rc = group->backends[i]->detectControllers(group, controllers);
+ int rc = group->backends[i]->detectControllers(group, controllers, parent);
if (rc < 0)
return -1;
controllersAvailable |= rc;
static int
-virCgroupV2ParseControllersFile(virCgroupPtr group)
+virCgroupV2ParseControllersFile(virCgroupPtr group,
+ virCgroupPtr parent)
{
int rc;
VIR_AUTOFREE(char *) contStr = NULL;
char **contList = NULL;
char **tmp;
- if (virAsprintf(&contFile, "%s%s/cgroup.controllers",
- group->unified.mountPoint,
- NULLSTR_EMPTY(group->unified.placement)) < 0)
- return -1;
+ if (parent) {
+ if (virAsprintf(&contFile, "%s%s/cgroup.subtree_control",
+ parent->unified.mountPoint,
+ NULLSTR_EMPTY(parent->unified.placement)) < 0)
+ return -1;
+ } else {
+ if (virAsprintf(&contFile, "%s%s/cgroup.controllers",
+ group->unified.mountPoint,
+ NULLSTR_EMPTY(group->unified.placement)) < 0)
+ return -1;
+ }
rc = virFileReadAll(contFile, 1024 * 1024, &contStr);
if (rc < 0) {
static int
virCgroupV2DetectControllers(virCgroupPtr group,
- int controllers)
+ int controllers,
+ virCgroupPtr parent)
{
size_t i;
- if (virCgroupV2ParseControllersFile(group) < 0)
+ if (virCgroupV2ParseControllersFile(group, parent) < 0)
return -1;
/* In cgroup v2 there is no cpuacct controller, the cpu.stat file always