|
Pablo Greco |
40546a |
From aa652c60bb88208f8a73b8d5ae87eab7cb24d23c Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <aa652c60bb88208f8a73b8d5ae87eab7cb24d23c@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:07:46 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: introduce virCgroupV2(Set|Get)CpuShares
|
|
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 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit b8ca5afc22b4d3af3c8637573f1c3d12887fbb0a)
|
|
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: <5b6c973caaa4b82333949366f034eccaec24277c.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 | 23 +++++++++++++++++++++++
|
|
Pablo Greco |
40546a |
1 file changed, 23 insertions(+)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
index 8d184bd963..cb9dd3d8e8 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
@@ -1305,6 +1305,26 @@ virCgroupV2GetMemSwapUsage(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV2SetCpuShares(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ unsigned long long shares)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupSetValueU64(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPU,
|
|
Pablo Greco |
40546a |
+ "cpu.weight", shares);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV2GetCpuShares(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ unsigned long long *shares)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupGetValueU64(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPU,
|
|
Pablo Greco |
40546a |
+ "cpu.weight", shares);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
virCgroupBackend virCgroupV2Backend = {
|
|
Pablo Greco |
40546a |
.type = VIR_CGROUP_BACKEND_TYPE_V2,
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -1352,6 +1372,9 @@ virCgroupBackend virCgroupV2Backend = {
|
|
Pablo Greco |
40546a |
.setMemSwapHardLimit = virCgroupV2SetMemSwapHardLimit,
|
|
Pablo Greco |
40546a |
.getMemSwapHardLimit = virCgroupV2GetMemSwapHardLimit,
|
|
Pablo Greco |
40546a |
.getMemSwapUsage = virCgroupV2GetMemSwapUsage,
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ .setCpuShares = virCgroupV2SetCpuShares,
|
|
Pablo Greco |
40546a |
+ .getCpuShares = virCgroupV2GetCpuShares,
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|