[libvirt] [PATCH v2 4/6] util: vircgroupv2: enable CPU controller only if it's available

Pavel Hrdina phrdina at redhat.com
Fri Jun 21 13:32:44 UTC 2019


It might happen that we are not able to enable CPU controller so we
can enable it for thread sub-cgroups only if it's available in parent
cgroup.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
---
 src/util/vircgroupv2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 6bcbb7e1a0..3f4548b532 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -404,7 +404,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
                 return -1;
             }
 
-            if (virCgroupV2EnableController(parent,
+            if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
+                virCgroupV2EnableController(parent,
                                             VIR_CGROUP_CONTROLLER_CPU) < 0) {
                 return -1;
             }
-- 
2.21.0




More information about the libvir-list mailing list