diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index b11139bef1..56aa9cc064 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -446,28 +446,19 @@ static int virCgroupDetect(virCgroupPtr group, pid_t pid, int controllers, - const char *path, - virCgroupPtr parent) + const char *path) { - VIR_DEBUG("group=%p controllers=%d path=%s parent=%p", - group, controllers, path, parent); + VIR_DEBUG("group=%p controllers=%d path=%s", + group, controllers, path); if (virCgroupSetBackends(group) < 0) return -1; - if (parent) { - if (virCgroupCopyMounts(group, parent) < 0) - return -1; - } else { - if (virCgroupDetectMounts(group) < 0) - return -1; - } + if (virCgroupDetectMounts(group) < 0) + return -1; - /* In some cases we can copy part of the placement info - * based on the parent cgroup... - */ - if (parent || path[0] == '/') { - if (virCgroupCopyPlacement(group, path, parent) < 0) + if (path[0] == '/') { + if (virCgroupCopyPlacement(group, path, NULL) < 0) return -1; } @@ -479,7 +470,7 @@ virCgroupDetect(virCgroupPtr group, if (virCgroupValidatePlacement(group, pid) < 0) return -1; - if (virCgroupDetectControllers(group, controllers, parent) < 0) + if (virCgroupDetectControllers(group, controllers, NULL) < 0) return -1; return 0; @@ -708,15 +699,12 @@ virCgroupMakeGroup(virCgroupPtr parent, /** * virCgroupNew: * @path: path for the new group - * @parent: parent group, or NULL * @controllers: bitmask of controllers to activate * * Create a new cgroup storing it in @group. * * If @path starts with a '/' it is treated as an - * absolute path, and @parent is ignored. Otherwise - * it is treated as being relative to @parent. If - * @parent is NULL, then the placement of the current + * absolute path. Otherwise then the placement of the current * process is used. * * Returns 0 on success, -1 on error @@ -724,19 +712,18 @@ virCgroupMakeGroup(virCgroupPtr parent, int virCgroupNew(pid_t pid, const char *path, - virCgroupPtr parent, int controllers, virCgroupPtr *group) { g_autoptr(virCgroup) newGroup = NULL; - VIR_DEBUG("pid=%lld path=%s parent=%p controllers=%d group=%p", - (long long) pid, path, parent, controllers, group); + VIR_DEBUG("pid=%lld path=%s controllers=%d group=%p", + (long long) pid, path, controllers, group); *group = NULL; newGroup = g_new0(virCgroup, 1); - if (virCgroupDetect(newGroup, pid, controllers, path, parent) < 0) + if (virCgroupDetect(newGroup, pid, controllers, path) < 0) return -1; *group = g_steal_pointer(&newGroup); @@ -940,7 +927,7 @@ virCgroupNewPartition(const char *path, tmp++; *tmp = '\0'; - if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0) + if (virCgroupNew(-1, parentPath, controllers, &parent) < 0) return -1; } @@ -1156,7 +1143,6 @@ virCgroupEnableMissingControllers(char *path, if (virCgroupNew(pidleader, "/", - NULL, controllers, &parent) < 0) return -1; diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index af8bf99888..0ac62882a5 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -112,7 +112,6 @@ int virCgroupGetValueForBlkDev(const char *str, int virCgroupNew(pid_t pid, const char *path, - virCgroupPtr parent, int controllers, virCgroupPtr *group); diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 6bb819410b..b3e0f733b9 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void) g_autoptr(virCgroup) group = NULL; unsigned long long int mem_unlimited = 0ULL; - if (virCgroupNew(-1, "/", NULL, -1, &group) < 0) + if (virCgroupNew(-1, "/", -1, &group) < 0) return; if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY))