]> xenbits.xensource.com Git - libvirt.git/commitdiff
Revert "util: vircgroup: pass parent cgroup into virCgroupDetectControllersCB"
authorPavel Hrdina <phrdina@redhat.com>
Thu, 27 Jun 2019 13:50:22 +0000 (15:50 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Fri, 28 Jun 2019 13:17:26 +0000 (15:17 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/vircgroup.c
src/util/vircgroupbackend.h
src/util/vircgroupv1.c
src/util/vircgroupv2.c

index da506fc0b0ad3bee3009f9a3be89fc07f17ad9d5..e4675a0977760d8fb20a3fb4bfbf356ddbf2f1c4 100644 (file)
@@ -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;
index 1fe08511844b7b92ad8b4512f58a8c2eaa80746a..e58e327c68724c49e0d178e0cd1af744a6f48f26 100644 (file)
@@ -95,8 +95,7 @@ typedef char *
 
 typedef int
 (*virCgroupDetectControllersCB)(virCgroupPtr group,
-                                int controllers,
-                                virCgroupPtr parent);
+                                int controllers);
 
 typedef bool
 (*virCgroupHasControllerCB)(virCgroupPtr cgroup,
index 4231d8d6faa303240ad82255e306cd4a57554c5c..7968ab3cf02b05904683ec59fa16e13fb84c1734 100644 (file)
@@ -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;
index 502afb0b5600b90c3b8143204781d5ef52ca1666..b3297dbb1329229be50e17852696b7e7cbadd9ea 100644 (file)
@@ -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;