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/svm.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/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index b25f4e117e71..8193651dd815 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -577,7 +577,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) | |||
577 | struct page *page; | 577 | struct page *page; |
578 | int err; | 578 | int err; |
579 | 579 | ||
580 | svm = kzalloc(sizeof *svm, GFP_KERNEL); | 580 | svm = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL); |
581 | if (!svm) { | 581 | if (!svm) { |
582 | err = -ENOMEM; | 582 | err = -ENOMEM; |
583 | goto out; | 583 | goto out; |
@@ -1849,7 +1849,8 @@ static struct kvm_arch_ops svm_arch_ops = { | |||
1849 | 1849 | ||
1850 | static int __init svm_init(void) | 1850 | static int __init svm_init(void) |
1851 | { | 1851 | { |
1852 | return kvm_init_arch(&svm_arch_ops, THIS_MODULE); | 1852 | return kvm_init_arch(&svm_arch_ops, sizeof(struct vcpu_svm), |
1853 | THIS_MODULE); | ||
1853 | } | 1854 | } |
1854 | 1855 | ||
1855 | static void __exit svm_exit(void) | 1856 | static void __exit svm_exit(void) |