diff options
author | Sasha Levin <levinsasha928@gmail.com> | 2011-12-07 03:24:56 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:40 -0500 |
commit | 6b75e6bfef7ba108ac3df0d430d80dea68fde4bf (patch) | |
tree | 6b42f3eddc94650a55ccf8a6d57e0f2e9597a919 /arch/powerpc | |
parent | d37b1a037cae725e69e5bf96f58544b69d7c93a6 (diff) |
KVM: PPC: Use the vcpu kmem_cache when allocating new VCPUs
Currently the code kzalloc()s new VCPUs instead of using the kmem_cache
which is created when KVM is initialized.
Modify it to allocate VCPUs from that kmem_cache.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 0f1ddf0ec032..fdc804c83938 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -417,7 +417,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
417 | goto out; | 417 | goto out; |
418 | 418 | ||
419 | err = -ENOMEM; | 419 | err = -ENOMEM; |
420 | vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL); | 420 | vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL); |
421 | if (!vcpu) | 421 | if (!vcpu) |
422 | goto out; | 422 | goto out; |
423 | 423 | ||
@@ -469,7 +469,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
469 | return vcpu; | 469 | return vcpu; |
470 | 470 | ||
471 | free_vcpu: | 471 | free_vcpu: |
472 | kfree(vcpu); | 472 | kmem_cache_free(kvm_vcpu_cache, vcpu); |
473 | out: | 473 | out: |
474 | return ERR_PTR(err); | 474 | return ERR_PTR(err); |
475 | } | 475 | } |
@@ -483,7 +483,7 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) | |||
483 | if (vcpu->arch.vpa) | 483 | if (vcpu->arch.vpa) |
484 | kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.vpa); | 484 | kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.vpa); |
485 | kvm_vcpu_uninit(vcpu); | 485 | kvm_vcpu_uninit(vcpu); |
486 | kfree(vcpu); | 486 | kmem_cache_free(kvm_vcpu_cache, vcpu); |
487 | } | 487 | } |
488 | 488 | ||
489 | static void kvmppc_set_timer(struct kvm_vcpu *vcpu) | 489 | static void kvmppc_set_timer(struct kvm_vcpu *vcpu) |