]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table()
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Fri, 18 Dec 2015 09:54:49 +0000 (18:54 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 18 Dec 2015 18:07:45 +0000 (19:07 +0100)
Not just in order to clean up the code, but to make it faster by using
enhanced instructions: the initialization became 20-30% faster on our
testing machine.

Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c

index a1a3d1907fdcbecdfeb45ec9c157cbb680fdf1a0..7f5a82bb61e99f144d0eb2adab7a51a7774d2e7b 100644 (file)
@@ -2041,14 +2041,6 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
        }
 }
 
-static void init_shadow_page_table(struct kvm_mmu_page *sp)
-{
-       int i;
-
-       for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
-               sp->spt[i] = 0ull;
-}
-
 static void __clear_sp_write_flooding_count(struct kvm_mmu_page *sp)
 {
        sp->write_flooding_count = 0;
@@ -2128,7 +2120,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
                account_shadowed(vcpu->kvm, sp);
        }
        sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen;
-       init_shadow_page_table(sp);
+       clear_page(sp->spt);
        trace_kvm_mmu_get_page(sp, true);
        return sp;
 }