[PATCH v2 5/6] netperf: pin guest vcpus/memory/vhost thread to numa node

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

 



Dynamically checking hardware and pin guest cpu threads and
guest memory to last numa node

Changes from v1:
- assign numanode to -1 for netperf test

Signed-off-by: Amos Kong <akong@xxxxxxxxxx>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index a2939f8..c68a48c 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -1012,6 +1012,7 @@ variants:
         # sessions_rr = "50 100 250 500"
         # sizes = "64 256 512 1024"
         # sizes_rr = "64 256 512 1024"
+        numa_node = -1
         variants:
             - guest_guest:
                 vms += " vm2"
diff --git a/client/virt/tests/netperf.py b/client/virt/tests/netperf.py
index 214f351..bc4e436 100644
--- a/client/virt/tests/netperf.py
+++ b/client/virt/tests/netperf.py
@@ -26,12 +26,22 @@ def run_netperf(test, params, env):
     server_ctl = vm.get_address(1)
     session.close()
 
+    logging.debug(commands.getoutput("numactl --hardware"))
+    logging.debug(commands.getoutput("numactl --show"))
+    # pin guest vcpus/memory/vhost threads to last numa node of host by default
+    if params.get('numa_node'):
+        numa_node = int(params.get('numa_node'))
+        node = virt_utils.NumaNode(numa_node)
+        virt_test_utils.pin_vm_threads(vm, node)
+
     if "vm2" in params["vms"]:
         vm2 = env.get_vm("vm2")
         vm2.verify_alive()
         session2 = vm2.wait_for_login(timeout=login_timeout)
         client = vm2.get_address()
         session2.close()
+        if params.get('numa_node'):
+            virt_test_utils.pin_vm_threads(vm2, node)
 
     if params.get("client"):
         client = params["client"]
@@ -196,7 +206,10 @@ def launch_client(sessions, server, server_ctl, host, client, l, nf_args):
         return [nrx, ntx, nrxb, ntxb, nre, nrx_intr, ntx_intr, io_exit, irq_inj]
 
     def netperf_thread(i):
-        cmd = "%s -H %s -l %s %s" % (client_path, server, l, nf_args)
+        output = ssh_cmd(client, "numactl --hardware")
+        n = int(re.findall("available: (\d+) nodes", output)[0]) - 1
+        cmd = "numactl --cpunodebind=%s --membind=%s %s -H %s -l %s %s" % \
+                                    (n, n, client_path, server, l, nf_args)
         output = ssh_cmd(client, cmd)
         f = file("/tmp/netperf.%s.%s.nf" % (pid, i), "w")
         f.write(output)

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux