[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL715WJMnMaFZ8XmsXWNEEHft0JsKi+MUqLARTf+C7D5s3kEKw@mail.gmail.com>
Date: Thu, 29 Jul 2021 12:02:38 -0700
From: Mingwei Zhang <mizhang@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Ben Gardon <bgardon@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Jing Zhang <jingzhangos@...gle.com>
Subject: Re: [PATCH v2 3/3] KVM: x86/mmu: Add detailed page size stats
On Thu, Jul 29, 2021 at 11:45 AM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Mon, Jul 26, 2021, Ben Gardon wrote:
> > On Mon, Jul 26, 2021 at 10:54 AM Mingwei Zhang <mizhang@...gle.com> wrote:
> > > diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
> > > index 83e6c6965f1e..ad5638815311 100644
> > > --- a/arch/x86/kvm/mmu.h
> > > +++ b/arch/x86/kvm/mmu.h
> > > @@ -240,4 +240,6 @@ static inline bool kvm_memslots_have_rmaps(struct kvm *kvm)
> > > return smp_load_acquire(&kvm->arch.memslots_have_rmaps);
> > > }
> > >
> > > +void kvm_update_page_stats(struct kvm *kvm, int level, int count);
> > > +
> > > #endif
> > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > > index 442cc554ebd6..7e0fc760739b 100644
> > > --- a/arch/x86/kvm/mmu/mmu.c
> > > +++ b/arch/x86/kvm/mmu/mmu.c
> > > @@ -588,16 +588,22 @@ static bool mmu_spte_update(u64 *sptep, u64 new_spte)
> > > return flush;
> > > }
> > >
> > > +void kvm_update_page_stats(struct kvm *kvm, int level, int count)
> > > +{
> > > + atomic64_add(count, &kvm->stat.page_stats.pages[level - 1]);
> > > +}
>
> This can be static inline in the header. Ignoring prolog+RET, it's four instructions,
> and two of those are sign extending input params.
will do.It is really nice to see that this big function has been
finally shrinked to a single-line routine.
Powered by blists - more mailing lists