Skip to content

Commit 450917b

Browse files
Tianyu Lanbonzini
authored andcommitted
KVM/MMU: Simplify __kvm_sync_page() function
Merge check of "sp->role.cr4_pae != !!is_pae(vcpu))" and "vcpu-> arch.mmu.sync_page(vcpu, sp) == 0". kvm_mmu_prepare_zap_page() is called under both these conditions. Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 208320b commit 450917b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/x86/kvm/mmu.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,12 +2136,8 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
21362136
static bool __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
21372137
struct list_head *invalid_list)
21382138
{
2139-
if (sp->role.cr4_pae != !!is_pae(vcpu)) {
2140-
kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
2141-
return false;
2142-
}
2143-
2144-
if (vcpu->arch.mmu.sync_page(vcpu, sp) == 0) {
2139+
if (sp->role.cr4_pae != !!is_pae(vcpu)
2140+
|| vcpu->arch.mmu.sync_page(vcpu, sp) == 0) {
21452141
kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
21462142
return false;
21472143
}

0 commit comments

Comments
 (0)