Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58d2930f authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Marcelo Tosatti
Browse files

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: default avatarTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent faac2458
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -1053,9 +1053,11 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
		mask = xchg(&dirty_bitmap[i], 0);
		mask = xchg(&dirty_bitmap[i], 0);
		dirty_bitmap_buffer[i] = mask;
		dirty_bitmap_buffer[i] = mask;


		if (mask) {
			offset = i * BITS_PER_LONG;
			offset = i * BITS_PER_LONG;
		kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset,
			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
								mask);
								offset, mask);
		}
	}
	}


	spin_unlock(&kvm->mmu_lock);
	spin_unlock(&kvm->mmu_lock);