[PATCH v2 2/6] virt_test_utils: Add pin_vm_threads

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

 



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

Signed-off-by: Amos Kong <akong@xxxxxxxxxx>
---
 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)))

--
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