Currently we only pin guet memory to a numa-node,
taskset is used to pin vcpu thread to pyshical cpu core.
This patch pins guest cpus to a numa-node.

man page of numactl:
 --cpunodebind=nodes, -N nodes
   Only execute command on the CPUs of nodes.  Note that nodes may
   consist of multiple CPUs.  nodes may be specified as noted above.

Signed-off-by: Amos Kong <[email protected]>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index c00317a..3429630 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -696,9 +696,11 @@ class VM(virt_vm.BaseVM):
             numa_node = int(params.get("numa_node"))
             if numa_node < 0:
                 p = virt_utils.NumaNode(numa_node)
-                qemu_cmd += "numactl -m %s " % (int(p.get_node_num()) + 
numa_node)
+                n = int(p.get_node_num()) + numa_node
+                qemu_cmd += "numactl -N %s -m %s " % (n, n)
             else:
-                qemu_cmd += "numactl -m %s " % (numa_node - 1)
+                n = numa_node - 1
+                qemu_cmd += "numactl -N %s -m %s " % (n, n)
         # Add the qemu binary
         qemu_cmd += qemu_binary
         # Add the VM's name

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to