Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b75e6bf authored by Sasha Levin's avatar Sasha Levin Committed by Avi Kivity
Browse files

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: default avatarSasha Levin <levinsasha928@gmail.com>
Acked-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent d37b1a03
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
		goto out;

	err = -ENOMEM;
	vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL);
	vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
	if (!vcpu)
		goto out;

@@ -469,7 +469,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
	return vcpu;

free_vcpu:
	kfree(vcpu);
	kmem_cache_free(kvm_vcpu_cache, vcpu);
out:
	return ERR_PTR(err);
}
@@ -483,7 +483,7 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
	if (vcpu->arch.vpa)
		kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.vpa);
	kvm_vcpu_uninit(vcpu);
	kfree(vcpu);
	kmem_cache_free(kvm_vcpu_cache, vcpu);
}

static void kvmppc_set_timer(struct kvm_vcpu *vcpu)