aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2012-08-01 05:03:28 -0400
committerAvi Kivity <avi@redhat.com>2012-08-06 05:47:30 -0400
commitd89cc617b954aff4030fce178f7d86f59aaf713d (patch)
treed04f2ccdddd1d718044f47fdf8442054d87799f6 /virt
parent65fbe37c42ed75604c9a770639209dcee162ebe7 (diff)
KVM: Push rmap into kvm_arch_memory_slot
Two reasons: - x86 can integrate rmap and rmap_pde and remove heuristics in __gfn_to_rmap(). - Some architectures do not need rmap. Since rmap is one of the most memory consuming stuff in KVM, ppc'd better restrict the allocation to Book3S HV. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index bcf973ec98ff..14ec567816ab 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -550,16 +550,12 @@ static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
550static void kvm_free_physmem_slot(struct kvm_memory_slot *free, 550static void kvm_free_physmem_slot(struct kvm_memory_slot *free,
551 struct kvm_memory_slot *dont) 551 struct kvm_memory_slot *dont)
552{ 552{
553 if (!dont || free->rmap != dont->rmap)
554 vfree(free->rmap);
555
556 if (!dont || free->dirty_bitmap != dont->dirty_bitmap) 553 if (!dont || free->dirty_bitmap != dont->dirty_bitmap)
557 kvm_destroy_dirty_bitmap(free); 554 kvm_destroy_dirty_bitmap(free);
558 555
559 kvm_arch_free_memslot(free, dont); 556 kvm_arch_free_memslot(free, dont);
560 557
561 free->npages = 0; 558 free->npages = 0;
562 free->rmap = NULL;
563} 559}
564 560
565void kvm_free_physmem(struct kvm *kvm) 561void kvm_free_physmem(struct kvm *kvm)
@@ -768,11 +764,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
768 if (npages && !old.npages) { 764 if (npages && !old.npages) {
769 new.user_alloc = user_alloc; 765 new.user_alloc = user_alloc;
770 new.userspace_addr = mem->userspace_addr; 766 new.userspace_addr = mem->userspace_addr;
771#ifndef CONFIG_S390 767
772 new.rmap = vzalloc(npages * sizeof(*new.rmap));
773 if (!new.rmap)
774 goto out_free;
775#endif /* not defined CONFIG_S390 */
776 if (kvm_arch_create_memslot(&new, npages)) 768 if (kvm_arch_create_memslot(&new, npages))
777 goto out_free; 769 goto out_free;
778 } 770 }
@@ -831,7 +823,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
831 823
832 /* actual memory is freed via old in kvm_free_physmem_slot below */ 824 /* actual memory is freed via old in kvm_free_physmem_slot below */
833 if (!npages) { 825 if (!npages) {
834 new.rmap = NULL;
835 new.dirty_bitmap = NULL; 826 new.dirty_bitmap = NULL;
836 memset(&new.arch, 0, sizeof(new.arch)); 827 memset(&new.arch, 0, sizeof(new.arch));
837 } 828 }