diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-07-30 07:12:19 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:21 -0400 |
commit | c16f862d0257349607b7a9be7b4a4b7ed419a3ab (patch) | |
tree | f84e9f43f845640a0cc887fe8697ab0b3a4e788b /drivers/kvm/vmx.c | |
parent | e7d5d76cae970117affe07f809faf0f18bbac675 (diff) |
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>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index f770f55d46c..2b30274656f 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -2365,7 +2365,7 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu) | |||
2365 | static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | 2365 | static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) |
2366 | { | 2366 | { |
2367 | int err; | 2367 | int err; |
2368 | struct vcpu_vmx *vmx = kzalloc(sizeof(*vmx), GFP_KERNEL); | 2368 | struct vcpu_vmx *vmx = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL); |
2369 | int cpu; | 2369 | int cpu; |
2370 | 2370 | ||
2371 | if (!vmx) | 2371 | if (!vmx) |
@@ -2490,7 +2490,7 @@ static int __init vmx_init(void) | |||
2490 | memset(iova, 0xff, PAGE_SIZE); | 2490 | memset(iova, 0xff, PAGE_SIZE); |
2491 | kunmap(vmx_io_bitmap_b); | 2491 | kunmap(vmx_io_bitmap_b); |
2492 | 2492 | ||
2493 | r = kvm_init_arch(&vmx_arch_ops, THIS_MODULE); | 2493 | r = kvm_init_arch(&vmx_arch_ops, sizeof(struct vcpu_vmx), THIS_MODULE); |
2494 | if (r) | 2494 | if (r) |
2495 | goto out1; | 2495 | goto out1; |
2496 | 2496 | ||