Skip to content

Commit 0dbd054

Browse files
KunWuChansean-jc
authored andcommitted
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. Note, KMEM_CACHE() uses the required alignment of the struct, '8' as the alignment, whereas KVM's existing code passes '0'. In the end, the two values yield the same result as x86's minimum slab alignment is also '8' (which is not at all coincidental). Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20240116100025.95702-1-chentao@kylinos.cn [sean: call out alignment behavior] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 41bccc9 commit 0dbd054

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6997,9 +6997,7 @@ int kvm_mmu_vendor_module_init(void)
69976997

69986998
kvm_mmu_reset_all_pte_masks();
69996999

7000-
pte_list_desc_cache = kmem_cache_create("pte_list_desc",
7001-
sizeof(struct pte_list_desc),
7002-
0, SLAB_ACCOUNT, NULL);
7000+
pte_list_desc_cache = KMEM_CACHE(pte_list_desc, SLAB_ACCOUNT);
70037001
if (!pte_list_desc_cache)
70047002
goto out;
70057003

0 commit comments

Comments
 (0)