Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- 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"); +} + + +/** + * 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, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.memory_migrate", + &value); + *migrate = !!value; + return ret; +} + + +/** * 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); -- 2.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list