KVM: x86/mmu: Don't zero-allocate page table used for splitting a hugepage
Sean Christopherson
maintainerPATCH 1/1 KVM: x86/mmu: Don't zero-allocate page table used for splitting a hugepage
When splitting hugepages in the TDP MMU, don't zero the new page table on allocation since tdp_mmu_split_huge_page() is guaranteed to write every entry and thus every byte.
Unless someone peeks at the memory between allocating the page table and writing the child SPTEs, no functional change intended.
--- arch/x86/kvm/mmu/tdp_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu/tdp_mmu.c +1 -1
@@ -1507,7 +1507,7 @@ static struct kvm_mmu_page *tdp_mmu_alloc_sp_for_split(void)if (!sp)return NULL ; - sp->spt = (void *)get_zeroed_page (GFP_KERNEL_ACCOUNT ); + sp->spt = (void *)__get_free_page (GFP_KERNEL_ACCOUNT );if (!sp->spt) {kmem_cache_free (mmu_page_header_cache, sp);return NULL ;
base-commit: 183bb0ce8c77b0fd1fb25874112bc8751a461e49
Signature · 1 line
2.53.0.345.g96ddfc5eaa-goog
Quoted 7 lines · Sean Christopherson
When splitting hugepages in the TDP MMU, don't zero the new page table on allocation since
tdp_mmu_split_huge_page()is guaranteed to write every entry and thus every byte.Unless someone peeks at the memory between allocating the page table and writing the child SPTEs
Didn't see any way for this to happen.
Quoted 6 lines
, no functional change intended.
Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Signed-off-by Sean Christopherson <[email protected]>---
Quoted 11 lines · Sean Christopherson
When splitting hugepages in the TDP MMU, don't zero the new page table on allocation since
tdp_mmu_split_huge_page()is guaranteed to write every entry and thus every byte.Unless someone peeks at the memory between allocating the page table and writing the child SPTEs, no functional change intended.
Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Signed-off-by Sean Christopherson <[email protected]>
Quoted 8 lines · Sean Christopherson
When splitting hugepages in the TDP MMU, don't zero the new page table on allocation since
tdp_mmu_split_huge_page()is guaranteed to write every entry and thus every byte.Unless someone peeks at the memory between allocating the page table and writing the child SPTEs, no functional change intended.
[...]
Applied to kvm-x86 mmu, thanks!
[1/1] KVM: x86/mmu: Don't zero-allocate page table used for splitting a hugepage
https://github.com/kvm-x86/linux/commit/ecb806293213