2024-01-16 10:11:32

by Kunwu Chan

[permalink] [raw]
Subject: [PATCH] KVM: x86/mmu: Use KMEM_CACHE instead of kmem_cache_create()

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <[email protected]>
---
arch/x86/kvm/mmu/mmu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index d59e3ba5d646..5f0d8148cf6e 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -6997,9 +6997,7 @@ int kvm_mmu_vendor_module_init(void)

kvm_mmu_reset_all_pte_masks();

- pte_list_desc_cache = kmem_cache_create("pte_list_desc",
- sizeof(struct pte_list_desc),
- 0, SLAB_ACCOUNT, NULL);
+ pte_list_desc_cache = KMEM_CACHE(pte_list_desc, SLAB_ACCOUNT);
if (!pte_list_desc_cache)
goto out;

--
2.39.2



2024-02-03 00:15:39

by Sean Christopherson

[permalink] [raw]
Subject: Re: [PATCH] KVM: x86/mmu: Use KMEM_CACHE instead of kmem_cache_create()

On Tue, 16 Jan 2024 18:00:25 +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
>
>

Applied to kvm-x86 mmu, with a slightly expanded changelog. Thanks!

[1/1] KVM: x86/mmu: Use KMEM_CACHE instead of kmem_cache_create()
https://github.com/kvm-x86/linux/commit/0dbd05469966

--
https://github.com/kvm-x86/linux/tree/next