This function is used to pin vhost and vcpu threads of VM to
host cpu (in same numa node).

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

diff --git a/client/virt/virt_test_utils.py b/client/virt/virt_test_utils.py
index 6b0d7eb..7864d2a 100644
--- a/client/virt/virt_test_utils.py
+++ b/client/virt/virt_test_utils.py
@@ -811,3 +811,14 @@ def run_virt_sub_test(test, params, env, sub_type=None):
     # Run the test function
     run_func = getattr(test_module, "run_%s" % sub_type)
     run_func(test, params, env)
+
+def pin_vm_threads(vm, node):
+    """
+    Pin VM threads to single cpu of a numa node
+    @param vm: VM object
+    @param node: NumaNode object
+    """
+    for i in vm.vhost_threads:
+        logging.info("pin vhost thread(%s) to cpu(%s)" % (i, node.pin_cpu(i)))
+    for i in vm.vcpu_threads:
+        logging.info("pin vcpu thread(%s) to cpu(%s)" % (i, node.pin_cpu(i)))

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

Reply via email to