OSDN Git Service

KVM: x86/mmu: Lazily allocate memslot rmaps
authorBen Gardon <bgardon@google.com>
Tue, 18 May 2021 17:34:14 +0000 (10:34 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Jun 2021 17:09:27 +0000 (13:09 -0400)
commitd501f747ef5c0ac0c917f9a6781d04ae4ae39d63
tree4e083219aaff30031d8df1fb0463279ba0cba222
parente2209710ccc5d28d8b88c822d2f3e03b269a2856
KVM: x86/mmu: Lazily allocate memslot rmaps

If the TDP MMU is in use, wait to allocate the rmaps until the shadow
MMU is actually used. (i.e. a nested VM is launched.) This saves memory
equal to 0.2% of guest memory in cases where the TDP MMU is used and
there are no nested guests involved.

Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20210518173414.450044-8-bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/mmu/tdp_mmu.h
arch/x86/kvm/x86.c