From: Tianyu Lan Subject: [PATCH] KVM/MMU: Simplify __kvm_sync_page() function Date: Wed, 18 Jul 2018 06:12:04 +0000 Message-ID: <20180718061103.61920-1-Tianyu.Lan@microsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Tianyu Lan , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: unlisted-recipients:; (no To-header on input) Return-path: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Merge check of "sp->role.cr4_pae !=3D !!is_pae(vcpu))" and "vcpu-> arch.mmu.sync_page(vcpu, sp) =3D=3D 0". kvm_mmu_prepare_zap_page() is called under both these conditions. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d594690d8b95..c2c1fd66fb36 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2117,12 +2117,8 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm, static bool __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp= , struct list_head *invalid_list) { - if (sp->role.cr4_pae !=3D !!is_pae(vcpu)) { - kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list); - return false; - } - - if (vcpu->arch.mmu.sync_page(vcpu, sp) =3D=3D 0) { + if (sp->role.cr4_pae !=3D !!is_pae(vcpu) + || vcpu->arch.mmu.sync_page(vcpu, sp) =3D=3D 0) { kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list); return false; } --=20 2.14.3