[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 02/10] Add functions to set/get cpuset parameters



---
 src/libvirt_private.syms |    6 +++
 src/util/cgroup.c        |   80 ++++++++++++++++++++++++++++++++++++++++++++++
 src/util/cgroup.h        |    7 ++++
 3 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6a1562e..64da63d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -78,6 +78,9 @@ virCgroupGetCpuShares;
 virCgroupGetCpuCfsPeriod;
 virCgroupGetCpuCfsQuota;
 virCgroupGetCpuacctUsage;
+virCgroupGetCpusetHardwall;
+virCgroupGetCpusetMemExclusive;
+virCgroupGetCpusetMems;
 virCgroupGetFreezerState;
 virCgroupGetMemoryHardLimit;
 virCgroupGetMemorySoftLimit;
@@ -93,6 +96,9 @@ virCgroupSetBlkioWeight;
 virCgroupSetCpuShares;
 virCgroupSetCpuCfsPeriod;
 virCgroupSetCpuCfsQuota;
+virCgroupSetCpusetHardwall;
+virCgroupSetCpusetMemExclusive;
+virCgroupSetCpusetMems;
 virCgroupSetFreezerState;
 virCgroupSetMemory;
 virCgroupSetMemoryHardLimit;
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index c8d1f33..7b01a1c 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -1154,6 +1154,86 @@ int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
 }
 
 /**
+ * virCgroupSetCpusetMems:
+ *
+ * @group: The cgroup to set cpuset.mems for
+ * @mems: the numa nodes to set
+ *
+ * Returns: 0 on success
+ */
+int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
+{
+    return virCgroupSetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mems",
+                                mems);
+}
+
+/**
+ * virCgroupGetCpusetMems:
+ *
+ * @group: The cgroup to get cpuset.mems for
+ * @mems: the numa nodes to get
+ *
+ * Returns: 0 on success
+ */
+int virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
+{
+    return virCgroupGetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mems",
+                                mems);
+}
+
+/**
+ * virCgroupSetCpusetHardwall:
+ *
+ * @group: The cgroup to set cpuset.mems for
+ * @hardwall: the hardwall to set
+ *
+ * Returns: 0 on success
+ */
+int virCgroupSetCpusetHardwall(virCgroupPtr group, unsigned long long hardwall)
+{
+    return virCgroupSetValueU64(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mem_hardwall",
+                                hardwall);
+}
+
+/**
+ * virCgroupGetCpusetHardwall:
+ *
+ * @group: The cgroup to get cpuset.mem_hardwall for
+ * @hardwall: the hardwall to get
+ *
+ * Returns: 0 on success
+ */
+int virCgroupGetCpusetHardwall(virCgroupPtr group, unsigned long long *hardwall)
+{
+    return virCgroupGetValueU64(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mem_hardwall",
+                                hardwall);
+}
+
+int virCgroupSetCpusetMemExclusive(virCgroupPtr group, unsigned long long memExclusive)
+{
+    return virCgroupSetValueU64(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mem_exclusive",
+                                memExclusive);
+}
+
+int virCgroupGetCpusetMemExclusive(virCgroupPtr group, unsigned long long *memExclusive)
+{
+    return virCgroupGetValueU64(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.mem_exclusive",
+                                memExclusive);
+}
+
+/**
  * virCgroupDenyAllDevices:
  *
  * @group: The cgroup to deny all permissions, for all devices
diff --git a/src/util/cgroup.h b/src/util/cgroup.h
index d190bb3..c9d891b 100644
--- a/src/util/cgroup.h
+++ b/src/util/cgroup.h
@@ -115,6 +115,13 @@ int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage);
 int virCgroupSetFreezerState(virCgroupPtr group, const char *state);
 int virCgroupGetFreezerState(virCgroupPtr group, char **state);
 
+int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems);
+int virCgroupGetCpusetMems(virCgroupPtr group, char **mems);
+int virCgroupSetCpusetMemExclusive(virCgroupPtr group, unsigned long long memExclusive);
+int virCgroupGetCpusetMemExclusive(virCgroupPtr group, unsigned long long *memExclusive);
+int virCgroupSetCpusetHardwall(virCgroupPtr group, unsigned long long hardwall);
+int virCgroupGetCpusetHardwall(virCgroupPtr group, unsigned long long *hardwall);
+
 int virCgroupRemove(virCgroupPtr group);
 
 void virCgroupFree(virCgroupPtr *group);
-- 
1.7.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]