[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBzS9WnZu9VtSVAt@google.com>
Date: Thu, 23 Mar 2023 15:30:13 -0700
From: David Matlack <dmatlack@...gle.com>
To: Vipin Sharma <vipinsh@...gle.com>
Cc: seanjc@...gle.com, pbonzini@...hat.com, bgardon@...gle.com,
jmattson@...gle.com, mizhang@...gle.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [Patch v4 15/18] KVM: mmu: Add NUMA node support in struct
kvm_mmu_memory_cache{}
On Mon, Mar 06, 2023 at 02:41:24PM -0800, Vipin Sharma wrote:
> Add NUMA node id variable in struct kvm_mmu_memory_cache{}. This
> variable denotes preferable NUMA node from which memory will be
> allocated under this memory cache.
>
> Set this variable to NUMA_NO_NODE if there is no preferred node.
>
> MIPS doesn't do any sort of initializatino of struct
> kvm_mmu_memory_cache{}. Keep things similar in MIPS by setting gfp_zero
> to 0 as INIT_KVM_MMU_MEMORY_CACHE() will initialize it to __GFP_ZERO.
>
> "node" cannot be left as 0, as 0 is a valid NUMA node value.
>
> Signed-off-by: Vipin Sharma <vipinsh@...gle.com>
> ---
> arch/mips/kvm/mips.c | 3 +++
> include/linux/kvm_types.h | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
> index 36c8991b5d39..5ec5ce919918 100644
> --- a/arch/mips/kvm/mips.c
> +++ b/arch/mips/kvm/mips.c
> @@ -294,6 +294,9 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
> HRTIMER_MODE_REL);
> vcpu->arch.comparecount_timer.function = kvm_mips_comparecount_wakeup;
>
> + INIT_KVM_MMU_MEMORY_CACHE(&vcpu->arch.mmu_page_cache);
> + vcpu->arch.mmu_page_cache.gfp_zero = 0;
Oh MIPS is here. Why isn't MIPS covered in the previous commits?
> +
> /*
> * Allocate space for host mode exception handlers that handle
> * guest mode exits
> diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
> index 5da7953532ce..b2a405c8e629 100644
> --- a/include/linux/kvm_types.h
> +++ b/include/linux/kvm_types.h
> @@ -97,10 +97,13 @@ struct kvm_mmu_memory_cache {
> struct kmem_cache *kmem_cache;
> int capacity;
> void **objects;
> + /* Preferred NUMA node of memory allocation. */
> + int node;
> };
>
> #define KVM_MMU_MEMORY_CACHE_INIT() { \
> .gfp_zero = __GFP_ZERO, \
> + .node = NUMA_NO_NODE, \
> }
>
> #define KVM_MMU_MEMORY_CACHE(_name) \
> --
> 2.40.0.rc0.216.gc4246ad0f0-goog
>
Powered by blists - more mailing lists