KVM: Use kmem cache for allocating vcpus

Avi wants the allocations of vcpus centralized again.  The easiest way
is to add a "size" arg to kvm_init_arch, and expose the thus-prepared
cache to the modules.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
Rusty Russell
2007-07-30 21:12:19 +10:00
committed by Avi Kivity
parent e7d5d76cae
commit c16f862d02
4 changed files with 23 additions and 6 deletions

View File

@@ -141,6 +141,7 @@ struct kvm_mmu_page {
};
struct kvm_vcpu;
extern struct kmem_cache *kvm_vcpu_cache;
/*
* x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
@@ -483,7 +484,8 @@ extern struct kvm_arch_ops *kvm_arch_ops;
int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module);
int kvm_init_arch(struct kvm_arch_ops *ops, unsigned int vcpu_size,
struct module *module);
void kvm_exit_arch(void);
int kvm_mmu_module_init(void);