From: Takuya Yoshikawa Date: Tue, 17 Mar 2015 07:19:58 +0000 (+0900) Subject: KVM: Eliminate extra function calls in kvm_get_dirty_log_protect() X-Git-Tag: v4.1-rc1~189^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58d2930f4ee335ab703d768cb0318331fc1bb62c;p=platform%2Fkernel%2Flinux-exynos.git KVM: Eliminate extra function calls in kvm_get_dirty_log_protect() When all bits in mask are not set, kvm_arch_mmu_enable_log_dirty_pt_masked() has nothing to do. But since it needs to be called from the generic code, it cannot be inlined, and a few function calls, two when PML is enabled, are wasted. Since it is common to see many pages remain clean, e.g. framebuffers can stay calm for a long time, it is worth eliminating this overhead. Signed-off-by: Takuya Yoshikawa Reviewed-by: Paolo Bonzini Signed-off-by: Marcelo Tosatti --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 49900fc..ce7888a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1053,9 +1053,11 @@ int kvm_get_dirty_log_protect(struct kvm *kvm, mask = xchg(&dirty_bitmap[i], 0); dirty_bitmap_buffer[i] = mask; - offset = i * BITS_PER_LONG; - kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset, - mask); + if (mask) { + offset = i * BITS_PER_LONG; + kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, + offset, mask); + } } spin_unlock(&kvm->mmu_lock);