From 2395bf301cf76ffa863a3c2e125d52345cfbf6b5 Mon Sep 17 00:00:00 2001 Message-Id: <2395bf301cf76ffa863a3c2e125d52345cfbf6b5@dist-git> From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:08:23 +0200 Subject: [PATCH] Revert "util: vircgroup: pass parent cgroup into virCgroupDetectControllersCB" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko (cherry picked from commit d117431143d5b6dcfc8fae4a6b3fae23881d0937) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: <754b0ac5a0f1bd21e79eaeb71f6d2ab811446168.1561993100.git.phrdina@redhat.com> Reviewed-by: Ján Tomko --- 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 ff2a0b75b5..a7fb595bce 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -412,7 +412,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 05af118ec1..a825dc4be7 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -96,8 +96,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 5b218c7f78..58bd20d636 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -419,8 +419,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 bdeab397a3..b0ed889cc8 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -285,21 +285,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.22.0