[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bed5081-1f13-bc1e-6328-b2bb4517c54@google.com>
Date: Wed, 7 Apr 2021 09:59:55 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Wanpeng Li <kernellwp@...il.com>
Subject: Re: [PATCH v2] KVM: Explicitly use GFP_KERNEL_ACCOUNT for 'struct
kvm_vcpu' allocations
On Tue, 6 Apr 2021, Sean Christopherson wrote:
> Use GFP_KERNEL_ACCOUNT when allocating vCPUs to make it more obvious that
> that the allocations are accounted, to make it easier to audit KVM's
> allocations in the future, and to be consistent with other cache usage in
> KVM.
>
> When using SLAB/SLUB, this is a nop as the cache itself is created with
> SLAB_ACCOUNT.
>
> When using SLOB, there are caveats within caveats. SLOB doesn't honor
> SLAB_ACCOUNT, so passing GFP_KERNEL_ACCOUNT will result in vCPU
> allocations now being accounted. But, even that depends on internal
> SLOB details as SLOB will only go to the page allocator when its cache is
> depleted. That just happens to be extremely likely for vCPUs because the
> size of kvm_vcpu is larger than the a page for almost all combinations of
> architecture and page size. Whether or not the SLOB behavior is by
> design is unknown; it's just as likely that no SLOB users care about
> accounding and so no one has bothered to implemented support in SLOB.
> Regardless, accounting vCPU allocations will not break SLOB+KVM+cgroup
> users, if any exist.
>
> Cc: Wanpeng Li <kernellwp@...il.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Always happy to see this ambiguity (SLAB_ACCOUNT vs GFP_KERNEL_ACCOUNT)
resolved for slab allocations.
Acked-by: David Rientjes <rientjes@...gle.com>
Powered by blists - more mailing lists