aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-03-26 11:39:12 +0200
committerAvi Kivity <avi@qumranet.com>2008-03-26 11:39:12 +0200
commitc0af88e9014019f6392b06c11e836ca58acc7ede (patch)
treebbe5428bb5842255a748a274509635650189b451
parent7ea160be9a732ef6a77586d4b93da726f181fc3b (diff)
Revert "KVM: use get_task_mm() instead of atomic_inc the mm_count"kvm-64rc2kvm-64
This reverts commit 202761268a29d4cd3a3fec35e6d6f2f239374635. The change caused a cycle that wouldn't let virtual machines to be deallocated (due to the mm holding a ref to the file table, which holds a ref to kvm). Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--virt/kvm/kvm_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a96a44f4e40d..30bf832c2362 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -186,7 +186,8 @@ static struct kvm *kvm_create_vm(void)
if (IS_ERR(kvm))
goto out;
- kvm->mm = get_task_mm(current);
+ kvm->mm = current->mm;
+ atomic_inc(&kvm->mm->mm_count);
spin_lock_init(&kvm->mmu_lock);
kvm_io_bus_init(&kvm->pio_bus);
mutex_init(&kvm->lock);
@@ -238,7 +239,7 @@ static void kvm_destroy_vm(struct kvm *kvm)
kvm_io_bus_destroy(&kvm->pio_bus);
kvm_io_bus_destroy(&kvm->mmio_bus);
kvm_arch_destroy_vm(kvm);
- mmput(mm);
+ mmdrop(mm);
}
static int kvm_vm_release(struct inode *inode, struct file *filp)