[PATCH v2] KVM: x86/mmu: Optimize kvm_zap_obsolete_pages execution time

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

 



From: Peng Hao <flyingpeng@xxxxxxxxxxx>

Optimize function execution by checking whether the active_mmu_pages
list is empty.

Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
---
 arch/x86/kvm/mmu/mmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 901be9e420a4..e8abf4387d1e 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -6353,6 +6353,9 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm)
 	int nr_zapped, batch = 0;
 	bool unstable;
 
+	if (list_empty(&kvm->arch.active_mmu_pages))
+		return;
+
 restart:
 	list_for_each_entry_safe_reverse(sp, node,
 	      &kvm->arch.active_mmu_pages, link) {
-- 
2.27.0





[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