From: Amos Kong <akong@redhat.com>
To: lmr@redhat.com, wquan@redhat.com, kvm@vger.kernel.org,
jasowang@redhat.com, rhod@redhat.com, autotest@test.kernel.org
Subject: [RFC PATCH 3/4] netperf: pin guest vcpus/memory/vhost thread to numa node
Date: Fri, 23 Dec 2011 18:28:44 +0800 [thread overview]
Message-ID: <20111223102844.29662.65380.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20111223102308.29662.59520.stgit@dhcp-8-167.nay.redhat.com>
Dynamically checking hardware and pin guest cpu threads and
guest memory to last numa node
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/virt/tests/netperf.py | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/client/virt/tests/netperf.py b/client/virt/tests/netperf.py
index 9c766bf..d4153fc 100644
--- a/client/virt/tests/netperf.py
+++ b/client/virt/tests/netperf.py
@@ -25,6 +25,20 @@ 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
+ numa_node = int(params.get('numa_node', -1))
+ p = virt_utils.NumaNode(numa_node)
+ node_num = int(p.get_node_num())
+ vhost_threads = commands.getoutput("ps aux |grep '\[vhost-.*\]'|grep -v grep|awk '{print $2}'")
+ for i in vhost_threads.split():
+ logging.debug("pin vhost_net thread(%s) to host cpu node" % i)
+ p.pin_cpu(i)
+ o = vm.monitor.info("cpus")
+ for i in re.findall("thread_id=(\d+)", o):
+ p.pin_cpu(i)
+
if "vm2" in params["vms"]:
vm2 = env.get_vm("vm2")
vm2.verify_alive()
@@ -198,7 +212,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)
next prev parent reply other threads:[~2011-12-23 10:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 10:28 [RFC PATCH 0/4] Network performance regression Amos Kong
2011-12-23 10:28 ` [RFC PATCH 1/4] virt-test: add NTttcp subtests Amos Kong
2011-12-23 10:28 ` [RFC PATCH 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2011-12-23 10:28 ` Amos Kong [this message]
2011-12-23 10:28 ` [RFC PATCH 4/4] virt: Introduce regression testing infrastructure Amos Kong
2011-12-24 1:13 ` Yang Hamo Bai
2011-12-25 1:26 ` Amos Kong
2011-12-29 13:12 ` [RFC PATCH 0/4] Network performance regression Amos Kong
2012-01-05 3:05 ` [Autotest PATCH v2 " Amos Kong
2012-01-05 3:05 ` [Autotest PATCH v2 1/4] virt-test: add NTttcp subtests Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 3/4] netperf: pin guest vcpus/memory/vhost thread to numa node Amos Kong
2012-01-05 3:06 ` [Autotest PATCH v2 4/4] virt: Introduce regression testing infrastructure Amos Kong
2012-01-06 20:17 ` [Autotest PATCH v2 0/4] Network performance regression Lucas Meneghel Rodrigues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111223102844.29662.65380.stgit@dhcp-8-167.nay.redhat.com \
--to=akong@redhat.com \
--cc=autotest@test.kernel.org \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
--cc=rhod@redhat.com \
--cc=wquan@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).