render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 0cde517cd560d47824e0e98fab32b62cbd0f89ea Mon Sep 17 00:00:00 2001
Message-Id: <0cde517cd560d47824e0e98fab32b62cbd0f89ea@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:08:12 +0200
Subject: [PATCH] util: implement virCgroupV2(Set|Get)CpusetMemoryMigrate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Cgroups v2 don't have memory_migrate interface and the migration is
enabled by default.

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

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

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

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 59b8c4ad2c..bc6ced2367 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1584,6 +1584,23 @@ virCgroupV2GetCpusetMems(virCgroupPtr group,
 }
 
 
+static int
+virCgroupV2SetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                  bool migrate ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+
+static int
+virCgroupV2GetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                  bool *migrate)
+{
+    *migrate = true;
+    return 0;
+}
+
+
 virCgroupBackend virCgroupV2Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
 
@@ -1646,6 +1663,8 @@ virCgroupBackend virCgroupV2Backend = {
 
     .setCpusetMems = virCgroupV2SetCpusetMems,
     .getCpusetMems = virCgroupV2GetCpusetMems,
+    .setCpusetMemoryMigrate = virCgroupV2SetCpusetMemoryMigrate,
+    .getCpusetMemoryMigrate = virCgroupV2GetCpusetMemoryMigrate,
 };
 
 
-- 
2.22.0