On 03/11/2015 08:39 AM, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/libvirt_private.syms | 2 ++
src/util/vircgroup.c | 42 +++++++++++++++++++++++++++++++++++++++++-
src/util/vircgroup.h | 5 ++++-
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e0d5459..f3d8517 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1130,6 +1130,7 @@ virCgroupGetCpuacctUsage;
virCgroupGetCpuCfsPeriod;
virCgroupGetCpuCfsQuota;
virCgroupGetCpusetCpus;
+virCgroupGetCpusetMemoryMigrate;
virCgroupGetCpusetMems;
virCgroupGetCpuShares;
virCgroupGetDevicePermsString;
@@ -1170,6 +1171,7 @@ virCgroupSetBlkioWeight;
virCgroupSetCpuCfsPeriod;
virCgroupSetCpuCfsQuota;
virCgroupSetCpusetCpus;
+virCgroupSetCpusetMemoryMigrate;
virCgroupSetCpusetMems;
virCgroupSetCpuShares;
virCgroupSetFreezerState;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 6957e81..5d3de10 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1,7 +1,7 @@
/*
* vircgroup.c: methods for managing control cgroups
*
- * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2010-2015 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* This library is free software; you can redistribute it and/or
@@ -872,6 +872,7 @@ virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
const char *inherit_values[] = {
"cpuset.cpus",
"cpuset.mems",
+ "cpuset.memory_migrate",
};
VIR_DEBUG("Setting up inheritance %s -> %s", parent->path,
group->path);
@@ -2671,6 +2672,45 @@ virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
/**
+ * virCgroupSetCpusetMemoryMigrate:
+ *
+ * @group: The cgroup to set cpuset.memory_migrate for
+ * @migrate: Whether to migrate the memory on change or not
+ *
+ * Returns: 0 on success
+ */
+int
+virCgroupSetCpusetMemoryMigrate(virCgroupPtr group, bool migrate)
+{
+ return virCgroupSetValueStr(group,
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.memory_migrate",
+ migrate ? "1" : "0");
+}
are my eyes deceiving me?... boolean here (1 or 0)
+
+
+/**
+ * virCgroupGetCpusetMemoryMigrate:
+ *
+ * @group: The cgroup to get cpuset.memory_migrate for
+ * @migrate: Migration setting
+ *
+ * Returns: 0 on success
+ */
+int
+virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
+{
+ unsigned long long value = 0;
+ int ret = virCgroupGetValueU64(group,
But we're getting a U64 here? for what's documented as "contains a flag
(0 or 1)
+ VIR_CGROUP_CONTROLLER_CPUSET,
+ "cpuset.memory_migrate",
+ &value);
+ *migrate = !!value;
+ return ret;
+}
Also there's no callers to this? I see that vircgrouptest.c exists and
there are a few API's called there - of course none for the
virCgroupGetCpuset*...
I think this is "ACKable" with perhaps usage of the right API to get at
the value.
John
+
+
+/**
* virCgroupSetCpusetCpus:
*
* @group: The cgroup to set cpuset.cpus for
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 9f984e7..bfb3a9b 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -1,7 +1,7 @@
/*
* vircgroup.h: methods for managing control cgroups
*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* This library is free software; you can redistribute it and/or
@@ -251,6 +251,9 @@ int virCgroupGetFreezerState(virCgroupPtr group, char **state);
int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems);
int virCgroupGetCpusetMems(virCgroupPtr group, char **mems);
+int virCgroupSetCpusetMemoryMigrate(virCgroupPtr group, bool migrate);
+int virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate);
+
int virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus);
int virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus);