KVM: async_pf: kill the unnecessary use_mm/unuse_mm async_pf_execute()
authorOleg Nesterov <oleg@redhat.com>
Mon, 21 Apr 2014 13:25:58 +0000 (15:25 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:18:41 +0000 (17:18 +0200)
async_pf_execute() has no reasons to adopt apf->mm, gup(current, mm)
should work just fine even if current has another or NULL ->mm.

Recently kvm_async_page_present_sync() was added insedie the "use_mm"
section, but it seems that it doesn't need current->mm too.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d72d946d0b649b79709b99b9d5cb7269fff8afaa)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/async_pf.c

index 06e6401d6ef45326edcbce4c8ff96e13286d2940..cda703e512d3dd46a4be8db299293929428cb6b7 100644 (file)
@@ -80,12 +80,10 @@ static void async_pf_execute(struct work_struct *work)
 
        might_sleep();
 
-       use_mm(mm);
        down_read(&mm->mmap_sem);
        get_user_pages(current, mm, addr, 1, 1, 0, NULL, NULL);
        up_read(&mm->mmap_sem);
        kvm_async_page_present_sync(vcpu, apf);
-       unuse_mm(mm);
 
        spin_lock(&vcpu->async_pf.lock);
        list_add_tail(&apf->link, &vcpu->async_pf.done);