render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Pablo Greco 40546a
From aa699de198c52868d08679176dd8355deb24ef82 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <aa699de198c52868d08679176dd8355deb24ef82@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:08:19 +0200
Pablo Greco 40546a
Subject: [PATCH] util: vircgroupv2: enable CPU controller only if it's
Pablo Greco 40546a
 available
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
It might happen that we are not able to enable CPU controller so we
Pablo Greco 40546a
can enable it for thread sub-cgroups only if it's available in parent
Pablo Greco 40546a
cgroup.
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
(cherry picked from commit f9d1c08557ddb981a0d889200431185a9c4920e0)
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <2a13e05dfbbe52f05541c881964ce92709e5d36a.1561993100.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroupv2.c | 3 ++-
Pablo Greco 40546a
 1 file changed, 2 insertions(+), 1 deletion(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
Pablo Greco 40546a
index 04cbadd6a6..98d313bf82 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -403,7 +403,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
Pablo Greco 40546a
                 return -1;
Pablo Greco 40546a
             }
Pablo Greco 40546a
 
Pablo Greco 40546a
-            if (virCgroupV2EnableController(parent,
Pablo Greco 40546a
+            if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
Pablo Greco 40546a
+                virCgroupV2EnableController(parent,
Pablo Greco 40546a
                                             VIR_CGROUP_CONTROLLER_CPU) < 0) {
Pablo Greco 40546a
                 return -1;
Pablo Greco 40546a
             }
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a