KVM: MMU: increment stats after event occurrence
PATCH 1/1 KVM: MMU: increment stats after event occurrence
From: Davidlohr Bueso <[email protected]>
It makes more sense to actually increment statistics for tlb flushes and page table entry updates after such _events_ occur, instead of before.
--- arch/x86/kvm/mmu.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu.c +2 -2
@@ -3130,8 +3130,8 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu,void kvm_mmu_flush_tlb (struct kvm_vcpu *vcpu) { - ++vcpu->stat.tlb_flush;kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu); + ++vcpu->stat.tlb_flush; }static void paging_new_cr3 (struct kvm_vcpu *vcpu)
@@ -3486,8 +3486,8 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,return ; } - ++vcpu->kvm->stat.mmu_pte_updated; vcpu->arch.mmu.update_pte (vcpu, sp, spte, new); + ++vcpu->kvm->stat.mmu_pte_updated; }static bool need_remote_flush (u64 old,u64 new)
Signature · 1 line
1.7.4.1
Quoted 3 lines · Davidlohr Bueso
From: Davidlohr Bueso<[email protected]>
It makes more sense to actually increment statistics for tlb flushes and page table entry updates after such _events_ occur, instead of before.
Why?
Takuya
Quoted 30 lines
Signed-off-by Davidlohr Bueso<[email protected]>--- arch/x86/kvm/mmu.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/mmu.c +2
-2@@ -3130,8 +3130,8 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu,void kvm_mmu_flush_tlb (struct kvm_vcpu *vcpu) { - ++vcpu->stat.tlb_flush;kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu); + ++vcpu->stat.tlb_flush; }static void paging_new_cr3 (struct kvm_vcpu *vcpu)@@ -3486,8 +3486,8 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,return ; } - ++vcpu->kvm->stat.mmu_pte_updated; vcpu->arch.mmu.update_pte (vcpu, sp, spte, new); + ++vcpu->kvm->stat.mmu_pte_updated; }static bool need_remote_flush (u64 old,u64 new)
Quoted 8 lines · Takuya Yoshikawa
Quoted 3 lines · Davidlohr Bueso
From: Davidlohr Bueso<[email protected]>
It makes more sense to actually increment statistics for tlb flushes and page table entry updates after such _events_ occur, instead of before.
Why?
From a logical point of view its better to increase stats once the event
is processed - usually because it can fail and therefore the stats would be incorrect.
Quoted 34 lines
Takuya
Quoted 30 lines
Signed-off-by Davidlohr Bueso<[email protected]>--- arch/x86/kvm/mmu.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/mmu.c +2
-2@@ -3130,8 +3130,8 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu,void kvm_mmu_flush_tlb (struct kvm_vcpu *vcpu) { - ++vcpu->stat.tlb_flush;kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu); + ++vcpu->stat.tlb_flush; }static void paging_new_cr3 (struct kvm_vcpu *vcpu)@@ -3486,8 +3486,8 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,return ; } - ++vcpu->kvm->stat.mmu_pte_updated; vcpu->arch.mmu.update_pte (vcpu, sp, spte, new); + ++vcpu->kvm->stat.mmu_pte_updated; }static bool need_remote_flush (u64 old,u64 new)
Quoted 4 lines · Davidlohr Bueso
Quoted 3 lines · Takuya Yoshikawa
Quoted 2 lines · Davidlohr Bueso
From: Davidlohr Bueso<[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It makes more sense to actually increment statistics for tlb flushes and page table entry updates after such _events_ occur, instead of before.
Why?
From a logical point of view its better to increase stats once the event is processed - usually because it can fail and therefore the stats would be incorrect.
That doesn't hold for the cases you change.
Signature · 1 line
error compiling committee.c: too many arguments to function