Revert "KVM: use get_task_mm() instead of atomic_inc the mm_count"
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>
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a96a44f..30bf832 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -186,7 +186,8 @@
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 @@
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)