Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932971AbbLRSIg (ORCPT ); Fri, 18 Dec 2015 13:08:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59627 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932091AbbLRSIe (ORCPT ); Fri, 18 Dec 2015 13:08:34 -0500 Subject: Re: [PATCH] KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table() To: Takuya Yoshikawa References: <20151218185449.3ba700d079a21ab9ff1508bb@lab.ntt.co.jp> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <56744B9E.6000607@redhat.com> Date: Fri, 18 Dec 2015 19:08:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151218185449.3ba700d079a21ab9ff1508bb@lab.ntt.co.jp> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1623 Lines: 53 On 18/12/2015 10:54, Takuya Yoshikawa wrote: > Not just in order to clean up the code, but to make it faster by using > enhanced instructions: the initialization became 20-30% faster on our > testing machine. > > Signed-off-by: Takuya Yoshikawa Applied locally, but I'm not sure when it will appear on kernel.org... it depends on the amount of testing I can do next week before the holidays. Anyway, it's not lost. :) Paolo > --- > arch/x86/kvm/mmu.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index a1a3d19..7f5a82b 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -2041,14 +2041,6 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu, > } > } > > -static void init_shadow_page_table(struct kvm_mmu_page *sp) > -{ > - int i; > - > - for (i = 0; i < PT64_ENT_PER_PAGE; ++i) > - sp->spt[i] = 0ull; > -} > - > static void __clear_sp_write_flooding_count(struct kvm_mmu_page *sp) > { > sp->write_flooding_count = 0; > @@ -2128,7 +2120,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, > account_shadowed(vcpu->kvm, sp); > } > sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen; > - init_shadow_page_table(sp); > + clear_page(sp->spt); > trace_kvm_mmu_get_page(sp, true); > return sp; > } > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/