render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 77eb53c13d2d9a641143cc374f8262c2cb004120 Mon Sep 17 00:00:00 2001
Message-Id: <77eb53c13d2d9a641143cc374f8262c2cb004120@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:08:14 +0200
Subject: [PATCH] util: enable cgroups v2 cpuset controller for threads
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When we create cgroup for qemu threads we need to enable cpuset
controller in order to use it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit a6aedcf39bd3212a3cd624b765bb724fd36d6a8a)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <1dfb136ea7a417fdcc03b84c59bb364a75e24d52.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/vircgroupv2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index ef1f286726..04638c4e50 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -401,6 +401,12 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
                                             VIR_CGROUP_CONTROLLER_CPU) < 0) {
                 return -1;
             }
+
+            if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPUSET) &&
+                virCgroupV2EnableController(parent,
+                                            VIR_CGROUP_CONTROLLER_CPUSET) < 0) {
+                return -1;
+            }
         } else {
             size_t i;
             for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
-- 
2.22.0