|
Pablo Greco |
40546a |
From 1f5aa6a591ba44492813f5a1a92d0fd2480ae3e7 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <1f5aa6a591ba44492813f5a1a92d0fd2480ae3e7@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:07:03 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: extract virCgroupV1(Set|Get)CpusetMems
|
|
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 |
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 41510b1b74b9d15a64aaefa83826ddf00c999fe0)
|
|
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: <163d30216cc48d77abac54b014faa779c64aa629.1561993100.git.phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/util/vircgroup.c | 10 ++--------
|
|
Pablo Greco |
40546a |
src/util/vircgroupbackend.h | 11 +++++++++++
|
|
Pablo Greco |
40546a |
src/util/vircgroupv1.c | 25 +++++++++++++++++++++++++
|
|
Pablo Greco |
40546a |
3 files changed, 38 insertions(+), 8 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
index 8b14c053e9..700e597157 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
@@ -1712,10 +1712,7 @@ virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
|
|
Pablo Greco |
40546a |
int
|
|
Pablo Greco |
40546a |
virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
- return virCgroupSetValueStr(group,
|
|
Pablo Greco |
40546a |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
- "cpuset.mems",
|
|
Pablo Greco |
40546a |
- mems);
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_BACKEND_CALL(group, setCpusetMems, -1, mems);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -1730,10 +1727,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
|
|
Pablo Greco |
40546a |
int
|
|
Pablo Greco |
40546a |
virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
- return virCgroupGetValueStr(group,
|
|
Pablo Greco |
40546a |
- VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
- "cpuset.mems",
|
|
Pablo Greco |
40546a |
- mems);
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_BACKEND_CALL(group, getCpusetMems, -1, mems);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
index 2c16706c96..35221e90df 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupbackend.h
|
|
Pablo Greco |
40546a |
@@ -324,6 +324,14 @@ typedef int
|
|
Pablo Greco |
40546a |
(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
char **state);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+typedef int
|
|
Pablo Greco |
40546a |
+(*virCgroupSetCpusetMemsCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ const char *mems);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+typedef int
|
|
Pablo Greco |
40546a |
+(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ char **mems);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
struct _virCgroupBackend {
|
|
Pablo Greco |
40546a |
virCgroupBackendType type;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -393,6 +401,9 @@ struct _virCgroupBackend {
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
virCgroupSetFreezerStateCB setFreezerState;
|
|
Pablo Greco |
40546a |
virCgroupGetFreezerStateCB getFreezerState;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ virCgroupSetCpusetMemsCB setCpusetMems;
|
|
Pablo Greco |
40546a |
+ virCgroupGetCpusetMemsCB getCpusetMems;
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
typedef struct _virCgroupBackend virCgroupBackend;
|
|
Pablo Greco |
40546a |
typedef virCgroupBackend *virCgroupBackendPtr;
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
index 7580f8b756..be9a6b82b4 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
@@ -1949,6 +1949,28 @@ virCgroupV1GetFreezerState(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV1SetCpusetMems(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ const char *mems)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupSetValueStr(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
+ "cpuset.mems",
|
|
Pablo Greco |
40546a |
+ mems);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV1GetCpusetMems(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ char **mems)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ return virCgroupGetValueStr(group,
|
|
Pablo Greco |
40546a |
+ VIR_CGROUP_CONTROLLER_CPUSET,
|
|
Pablo Greco |
40546a |
+ "cpuset.mems",
|
|
Pablo Greco |
40546a |
+ mems);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
virCgroupBackend virCgroupV1Backend = {
|
|
Pablo Greco |
40546a |
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -2016,6 +2038,9 @@ virCgroupBackend virCgroupV1Backend = {
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
.setFreezerState = virCgroupV1SetFreezerState,
|
|
Pablo Greco |
40546a |
.getFreezerState = virCgroupV1GetFreezerState,
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ .setCpusetMems = virCgroupV1SetCpusetMems,
|
|
Pablo Greco |
40546a |
+ .getCpusetMems = virCgroupV1GetCpusetMems,
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|