diff options
author | Avi Kivity <avi@qumranet.com> | 2007-06-07 12:11:53 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-07-16 05:05:46 -0400 |
commit | 39c3b86e5c193e09f69f0e99c93600a4999ffc60 (patch) | |
tree | 94272c98789224f53d4f4f19587a08d95103f837 /drivers/kvm/kvm_main.c | |
parent | 72d6e5a08a8ba2105b3f36e32285e8fbfbed1f71 (diff) |
KVM: Keep an upper bound of initialized vcpus
That way, we don't need to loop for KVM_MAX_VCPUS for a single vcpu
vm.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 556416962541..4e1a017f3db7 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -2391,6 +2391,11 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n) | |||
2391 | if (r < 0) | 2391 | if (r < 0) |
2392 | goto out_free_vcpus; | 2392 | goto out_free_vcpus; |
2393 | 2393 | ||
2394 | spin_lock(&kvm_lock); | ||
2395 | if (n >= kvm->nvcpus) | ||
2396 | kvm->nvcpus = n + 1; | ||
2397 | spin_unlock(&kvm_lock); | ||
2398 | |||
2394 | return r; | 2399 | return r; |
2395 | 2400 | ||
2396 | out_free_vcpus: | 2401 | out_free_vcpus: |