[PATCH] KVM: x86: Make the debugfs per VM optional

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

 



Creating a debugfs directory for each virtual machine is a suprisingly
costly operation as one has to synchronize multiple cores. However, short
living VMs seldom benefit from it.

Since there are valid use-cases we make this feature optional via a
module parameter. Disabling it saves 150us in the hello microbenchmark.

Signed-off-by: Bernhard Kauer <bk@xxxxxxxxx>
---
 virt/kvm/kvm_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a48861363649..760e39cf86a8 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -94,6 +94,9 @@ unsigned int halt_poll_ns_shrink = 2;
 module_param(halt_poll_ns_shrink, uint, 0644);
 EXPORT_SYMBOL_GPL(halt_poll_ns_shrink);
 
+bool debugfs_per_vm = true;
+module_param(debugfs_per_vm, bool, 0644);
+
 /*
  * Ordering of locks:
  *
@@ -1050,7 +1053,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, const char *fdname)
 	int kvm_debugfs_num_entries = kvm_vm_stats_header.num_desc +
 				      kvm_vcpu_stats_header.num_desc;
 
-	if (!debugfs_initialized())
+	if (!debugfs_initialized() || !debugfs_per_vm)
 		return 0;
 
 	snprintf(dir_name, sizeof(dir_name), "%d-%s", task_pid_nr(current), fdname);
-- 
2.45.2





[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