This reverts commit 7bca1c9bdc85247446129f856e27c80a32819e17.
As it turns out it's not a good idea on systemd hosts. The root
cgroup can have all controllers enabled but they don't have to be
enabled for sub-cgroups.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroup.c | 2 +-
src/util/vircgroupbackend.h | 3 +--
src/util/vircgroupv1.c | 3 +--
src/util/vircgroupv2.c | 17 ++++++-----------
4 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index da506fc0b0..e4675a0977 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -407,7 +407,7 @@ virCgroupDetect(virCgroupPtr group,
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
if (group->backends[i]) {
- int rc = group->backends[i]->detectControllers(group, controllers,
parent);
+ int rc = group->backends[i]->detectControllers(group, controllers);
if (rc < 0)
return -1;
controllersAvailable |= rc;
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index 1fe0851184..e58e327c68 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -95,8 +95,7 @@ typedef char *
typedef int
(*virCgroupDetectControllersCB)(virCgroupPtr group,
- int controllers,
- virCgroupPtr parent);
+ int controllers);
typedef bool
(*virCgroupHasControllerCB)(virCgroupPtr cgroup,
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 4231d8d6fa..7968ab3cf0 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -420,8 +420,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)
static int
virCgroupV1DetectControllers(virCgroupPtr group,
- int controllers,
- virCgroupPtr parent ATTRIBUTE_UNUSED)
+ int controllers)
{
size_t i;
size_t j;
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 502afb0b56..b3297dbb13 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -286,21 +286,16 @@ virCgroupV2ParseControllersFile(virCgroupPtr group)
static int
virCgroupV2DetectControllers(virCgroupPtr group,
- int controllers,
- virCgroupPtr parent)
+ int controllers)
{
size_t i;
- if (parent) {
- group->unified.controllers = parent->unified.controllers;
- } else {
- if (virCgroupV2ParseControllersFile(group) < 0)
- return -1;
+ if (virCgroupV2ParseControllersFile(group) < 0)
+ return -1;
- /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
- * exists with usage stats. */
- group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
- }
+ /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
+ * exists with usage stats. */
+ group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
if (controllers >= 0)
group->unified.controllers &= controllers;
--
2.21.0