kvm: remove .done from struct kvm_async_pf
authorRadim Krčmář <rkrcmar@redhat.com>
Wed, 4 Sep 2013 20:32:24 +0000 (22:32 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 24 Sep 2013 17:12:12 +0000 (19:12 +0200)
'.done' is used to mark the completion of 'async_pf_execute()', but
'cancel_work_sync()' returns true when the work was canceled, so we
use it instead.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/linux/kvm_host.h
virt/kvm/async_pf.c

index 0fbbc7aa02cb17c9c7d1cc5b5a17330d58858c10..749bdb12cd15504d602e475e6db47cf843e8d05e 100644 (file)
@@ -190,7 +190,6 @@ struct kvm_async_pf {
        unsigned long addr;
        struct kvm_arch_async_pf arch;
        struct page *page;
-       bool done;
 };
 
 void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu);
index 8a39dda7a3254677df5996c07c965a2f9f5ef8a8..b197950ac4d5893c146590de3e1b13ab60cc631d 100644 (file)
@@ -75,7 +75,6 @@ static void async_pf_execute(struct work_struct *work)
        spin_lock(&vcpu->async_pf.lock);
        list_add_tail(&apf->link, &vcpu->async_pf.done);
        apf->page = page;
-       apf->done = true;
        spin_unlock(&vcpu->async_pf.lock);
 
        /*
@@ -99,9 +98,8 @@ void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu)
                struct kvm_async_pf *work =
                        list_entry(vcpu->async_pf.queue.next,
                                   typeof(*work), queue);
-               cancel_work_sync(&work->work);
                list_del(&work->queue);
-               if (!work->done) { /* work was canceled */
+               if (cancel_work_sync(&work->work)) {
                        mmdrop(work->mm);
                        kvm_put_kvm(vcpu->kvm); /* == work->vcpu->kvm */
                        kmem_cache_free(async_pf_cache, work);
@@ -166,7 +164,6 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
                return 0;
 
        work->page = NULL;
-       work->done = false;
        work->vcpu = vcpu;
        work->gva = gva;
        work->addr = gfn_to_hva(vcpu->kvm, gfn);