]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Avoid wasting pages for small lpage_info arrays
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Sun, 20 May 2012 04:15:07 +0000 (13:15 +0900)
committerAvi Kivity <avi@redhat.com>
Tue, 5 Jun 2012 13:29:49 +0000 (16:29 +0300)
commit831777149b68da523b33c4ba24f3e06e2bd9cddd
tree6f61d847e217212de98c8bdc9563ef09e25019e1
parent0dd108650d201df18dcf70b37b917139e60ae852
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>
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c