Commit 5233009f authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: MIPS: Use kvm_vcpu_cache to allocate vCPUs

For reasons unknown, MIPS configures the vCPU allocation cache but
allocates vCPUs via kzalloc().  Allocate from the vCPU cache in
preparation for moving vCPU allocation to common KVM code.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent ff030fdf
...@@ -286,7 +286,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) ...@@ -286,7 +286,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
void *gebase, *p, *handler, *refill_start, *refill_end; void *gebase, *p, *handler, *refill_start, *refill_end;
int i; int i;
struct kvm_vcpu *vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL); struct kvm_vcpu *vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
if (!vcpu) { if (!vcpu) {
err = -ENOMEM; err = -ENOMEM;
...@@ -401,7 +401,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) ...@@ -401,7 +401,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
kvm_vcpu_uninit(vcpu); kvm_vcpu_uninit(vcpu);
out_free_cpu: out_free_cpu:
kfree(vcpu); kmem_cache_free(kvm_vcpu_cache, vcpu);
out: out:
return ERR_PTR(err); return ERR_PTR(err);
...@@ -418,7 +418,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) ...@@ -418,7 +418,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
kvm_mmu_free_memory_caches(vcpu); kvm_mmu_free_memory_caches(vcpu);
kfree(vcpu->arch.guest_ebase); kfree(vcpu->arch.guest_ebase);
kfree(vcpu->arch.kseg0_commpage); kfree(vcpu->arch.kseg0_commpage);
kfree(vcpu); kmem_cache_free(kvm_vcpu_cache, vcpu);
} }
void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment