Skip to content

Commit e1c04f7

Browse files
dmatlacksean-jc
authored andcommitted
KVM: x86/mmu: Hard code GFP flags for TDP MMU eager split allocations
Now that the GFP_NOWAIT case is gone, hard code GFP_KERNEL_ACCOUNT when allocating shadow pages during eager page splitting in the TDP MMU. Opportunistically replace use of __GFP_ZERO with allocations that zero to improve readability. No functional change intended. Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: David Matlack <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent cf3ff0e commit e1c04f7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,17 +1339,15 @@ bool kvm_tdp_mmu_wrprot_slot(struct kvm *kvm,
13391339
return spte_set;
13401340
}
13411341

1342-
static struct kvm_mmu_page *__tdp_mmu_alloc_sp_for_split(gfp_t gfp)
1342+
static struct kvm_mmu_page *__tdp_mmu_alloc_sp_for_split(void)
13431343
{
13441344
struct kvm_mmu_page *sp;
13451345

1346-
gfp |= __GFP_ZERO;
1347-
1348-
sp = kmem_cache_alloc(mmu_page_header_cache, gfp);
1346+
sp = kmem_cache_zalloc(mmu_page_header_cache, GFP_KERNEL_ACCOUNT);
13491347
if (!sp)
13501348
return NULL;
13511349

1352-
sp->spt = (void *)__get_free_page(gfp);
1350+
sp->spt = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
13531351
if (!sp->spt) {
13541352
kmem_cache_free(mmu_page_header_cache, sp);
13551353
return NULL;
@@ -1374,7 +1372,7 @@ static struct kvm_mmu_page *tdp_mmu_alloc_sp_for_split(struct kvm *kvm,
13741372
write_unlock(&kvm->mmu_lock);
13751373

13761374
iter->yielded = true;
1377-
sp = __tdp_mmu_alloc_sp_for_split(GFP_KERNEL_ACCOUNT);
1375+
sp = __tdp_mmu_alloc_sp_for_split();
13781376

13791377
if (shared)
13801378
read_lock(&kvm->mmu_lock);

0 commit comments

Comments
 (0)