From af1714ac39a383b8a8fb0bc577fbe5e85fd8be10 Mon Sep 17 00:00:00 2001 Message-Id: From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:06:09 +0200 Subject: [PATCH] vircgroup: Simplify if conditions in virCgroupMakeGroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Ján Tomko Signed-off-by: Pavel Hrdina (cherry picked from commit 0ec8416f04460f3bbf7907231b28028c3daed7e7) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: Reviewed-by: Ján Tomko --- src/util/vircgroup.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index dde9ed21a2..02de33f74f 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1079,24 +1079,20 @@ virCgroupMakeGroup(virCgroupPtr parent, goto error; } } - if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL && - (i == VIR_CGROUP_CONTROLLER_CPUSET || - STREQ(group->controllers[i].mountPoint, - group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) { - if (virCgroupCpuSetInherit(parent, group) < 0) - goto error; + if (i == VIR_CGROUP_CONTROLLER_CPUSET && + group->controllers[i].mountPoint != NULL && + virCgroupCpuSetInherit(parent, group) < 0) { + goto error; } /* * Note that virCgroupSetMemoryUseHierarchy should always be * called prior to creating subcgroups and attaching tasks. */ if ((flags & VIR_CGROUP_MEM_HIERACHY) && - (group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint != NULL) && - (i == VIR_CGROUP_CONTROLLER_MEMORY || - STREQ(group->controllers[i].mountPoint, - group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint))) { - if (virCgroupSetMemoryUseHierarchy(group) < 0) - goto error; + i == VIR_CGROUP_CONTROLLER_MEMORY && + group->controllers[i].mountPoint != NULL && + virCgroupSetMemoryUseHierarchy(group) < 0) { + goto error; } } } -- 2.22.0