]> xenbits.xensource.com Git - libvirt.git/commitdiff
vircgroup: no need to use PID in virCgroupEnableMissingControllers
authorPavel Hrdina <phrdina@redhat.com>
Thu, 15 Oct 2020 14:59:03 +0000 (16:59 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 3 Nov 2020 20:26:32 +0000 (21:26 +0100)
This function is relevant only with cgroups v1 where it creates
hierarchy for controllers that are not managed by systemd. PID is used
to detect a placement of current process but in this situation we are
building the hierarchy for already known placement.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/vircgroup.c

index 81aa3ee7910528904285e4c8c1aac8fdc1162f87..2c1d6f9f01e0c3208bd7781f705bc427d4e29018 100644 (file)
@@ -1112,14 +1112,13 @@ virCgroupNewDetectMachine(const char *name,
 
 static int
 virCgroupEnableMissingControllers(char *path,
-                                  pid_t pidleader,
                                   int controllers,
                                   virCgroupPtr *group)
 {
     g_autoptr(virCgroup) parent = NULL;
     char *offset = path;
 
-    if (virCgroupNew(pidleader,
+    if (virCgroupNew(-1,
                      "/",
                      controllers,
                      &parent) < 0)
@@ -1213,10 +1212,8 @@ virCgroupNewMachineSystemd(const char *name,
         return -2;
     }
 
-    if (virCgroupEnableMissingControllers(path, pidleader,
-                                          controllers, &newGroup) < 0) {
+    if (virCgroupEnableMissingControllers(path, controllers, &newGroup) < 0)
         return -1;
-    }
 
     if (virCgroupAddProcess(newGroup, pidleader) < 0) {
         virErrorPtr saved;