lkml.org 
[lkml]   [2021]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM allocations
Justin,

On Thu, Sep 9, 2021 at 8:57 AM Justin He <Justin.He@arm.com> wrote:
>
> Hi Oliver, thanks for the review, please my comments below:
>
> > -----Original Message-----
> > From: Oliver Upton <oupton@google.com>
> > Sent: Wednesday, September 8, 2021 6:29 AM
> > To: Justin He <Justin.He@arm.com>
> > Cc: Marc Zyngier <maz@kernel.org>; James Morse <James.Morse@arm.com>;
> > Alexandru Elisei <Alexandru.Elisei@arm.com>; Suzuki Poulose
> > <Suzuki.Poulose@arm.com>; Xiaoming Ni <nixiaoming@huawei.com>; Lorenzo
> > Pieralisi <Lorenzo.Pieralisi@arm.com>; Kees Cook <keescook@chromium.org>;
> > Catalin Marinas <Catalin.Marinas@arm.com>; Nick Desaulniers
> > <ndesaulniers@google.com>; linux-kernel@vger.kernel.org; Liu Shixin
> > <liushixin2@huawei.com>; Sami Tolvanen <samitolvanen@google.com>; Will
> > Deacon <will@kernel.org>; kvmarm@lists.cs.columbia.edu; linux-arm-
> > kernel@lists.infradead.org
> > Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM
> > allocations
> >
> > Hi Jia,
> >
> > On Tue, Sep 7, 2021 at 7:33 AM Jia He <justin.he@arm.com> wrote:
> > >
> > > Inspired by commit 254272ce6505 ("kvm: x86: Add memcg accounting to KVM
> > > allocations"), it would be better to make arm64 KVM consistent with
> > > common kvm codes.
> > >
> > > The memory allocations of VM scope should be charged into VM process
> > > cgroup, hence change GFP_KERNEL to GFP_KERNEL_ACCOUNT.
> > >
> > > There remain a few cases since these allocations are global, not in VM
> > > scope.
> >
> > I believe there are more memory allocations that could be switched to
> > GFP_KERNEL_ACCOUNT. For non-pKVM kernels, we probably should charge
> > all stage-2 paging structure allocations to the VM process. Your patch
> > appears to only change the allocation of the kvm_pgtable structure,
> > but not descendent paging structures.
> >
> Do you mean kvm_hyp_zalloc_page() here?
> Seems kvm_hyp_zalloc_page() is in both global and VM scopes.

Doh! kvm_hyp_zalloc_page() is only for the hyp's page tables, hence I
believe your patch is correct as it stands. As such:

Reviewed-by: Oliver Upton <oupton@google.com>

\
 
 \ /
  Last update: 2021-09-13 14:22    [W:0.084 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site