diff options
author | Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> | 2012-08-01 05:03:28 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-08-06 05:47:30 -0400 |
commit | d89cc617b954aff4030fce178f7d86f59aaf713d (patch) | |
tree | d04f2ccdddd1d718044f47fdf8442054d87799f6 /arch/powerpc/kvm/powerpc.c | |
parent | 65fbe37c42ed75604c9a770639209dcee162ebe7 (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 'arch/powerpc/kvm/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 87f4dc886076..879b14a61403 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -302,10 +302,18 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
302 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, | 302 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, |
303 | struct kvm_memory_slot *dont) | 303 | struct kvm_memory_slot *dont) |
304 | { | 304 | { |
305 | if (!dont || free->arch.rmap != dont->arch.rmap) { | ||
306 | vfree(free->arch.rmap); | ||
307 | free->arch.rmap = NULL; | ||
308 | } | ||
305 | } | 309 | } |
306 | 310 | ||
307 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) | 311 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) |
308 | { | 312 | { |
313 | slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap)); | ||
314 | if (!slot->arch.rmap) | ||
315 | return -ENOMEM; | ||
316 | |||
309 | return 0; | 317 | return 0; |
310 | } | 318 | } |
311 | 319 | ||