]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: Make VM ioctl do valloc for some archs
authorMarc Orr <marcorr@google.com>
Tue, 15 May 2018 11:37:37 +0000 (04:37 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 1 Jun 2018 17:18:26 +0000 (19:18 +0200)
commitb8ff20bdae867fc62edf324ca69fc0cb30837dbb
treeb0e6a402dc55ae6809456f40b690360cc8b687ca
parent306c6afbee17d33d5432c38bc53ce49b681475b8
kvm: Make VM ioctl do valloc for some archs

The kvm struct has been bloating. For example, it's tens of kilo-bytes
for x86, which turns out to be a large amount of memory to allocate
contiguously via kzalloc. Thus, this patch does the following:
1. Uses architecture-specific routines to allocate the kvm struct via
   vzalloc for x86.
2. Switches arm to __KVM_HAVE_ARCH_VM_ALLOC so that it can use vzalloc
   when has_vhe() is true.

Other architectures continue to default to kalloc, as they have a
dependency on kalloc or have a small-enough struct kvm.

Signed-off-by: Marc Orr <marcorr@google.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/arm/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_host.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
include/linux/kvm_host.h
virt/kvm/arm/arm.c