[PATCHv4 2/6] use cpuset to manage numa

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

 



From: Hu Tao <hutao@xxxxxxxxxxxxxx>

This patch also sets cgroup cpuset parameters for numatune.
---
 src/qemu/qemu_cgroup.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index d663798..2d970d6 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -389,6 +389,25 @@ int qemuSetupCgroup(struct qemud_driver *driver,
         }
     }

+    if (vm->def->numatune.memory.nodemask &&
+        vm->def->numatune.memory.mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
+        qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPUSET)) {
+        char *mask = virDomainCpuSetFormat(vm->def->numatune.memory.nodemask, VIR_DOMAIN_CPUMASK_LEN);
+        if (!mask) {
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("failed to convert memory nodemask"));
+            goto cleanup;
+        }
+
+        rc = virCgroupSetCpusetMems(cgroup, mask);
+        VIR_FREE(mask);
+        if (rc != 0) {
+            virReportSystemError(-rc,
+                                 _("Unable to set cpuset.mems for domain %s"),
+                                 vm->def->name);
+            goto cleanup;
+        }
+    }
 done:
     virCgroupFree(&cgroup);
     return 0;
-- 
1.7.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]