diff options
author | Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> | 2012-05-20 04:15:07 (GMT) |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-06-05 13:29:49 (GMT) |
commit | c1a7b32a14138f908df52d7c53b5ce3415ec6b50 (patch) | |
tree | 6f61d847e217212de98c8bdc9563ef09e25019e1 /include | |
parent | 92eca8faad2d1b136c939bc122842dcdabd6ff46 (diff) | |
download | linux-c1a7b32a14138f908df52d7c53b5ce3415ec6b50.tar.xz |
KVM: Avoid wasting pages for small lpage_info arrays
lpage_info is created for each large level even when the memory slot is
not for RAM. This means that when we add one slot for a PCI device, we
end up allocating at least KVM_NR_PAGE_SIZES - 1 pages by vmalloc().
To make things worse, there is an increasing number of devices which
would result in more pages being wasted this way.
This patch mitigates this problem by using kvm_kvzalloc().
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm_host.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index c446435..19b83f6 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -535,6 +535,9 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); void kvm_free_physmem(struct kvm *kvm); +void *kvm_kvzalloc(unsigned long size); +void kvm_kvfree(const void *addr); + #ifndef __KVM_HAVE_ARCH_VM_ALLOC static inline struct kvm *kvm_arch_alloc_vm(void) { |