summaryrefslogtreecommitdiffstats
path: root/kernel/virt/kvm/async_pf.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/virt/kvm/async_pf.c')
-rw-r--r--kernel/virt/kvm/async_pf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/virt/kvm/async_pf.c b/kernel/virt/kvm/async_pf.c
index cbcabb94c..9378d0919 100644
--- a/kernel/virt/kvm/async_pf.c
+++ b/kernel/virt/kvm/async_pf.c
@@ -94,8 +94,12 @@ static void async_pf_execute(struct work_struct *work)
trace_kvm_async_pf_completed(addr, gva);
- if (swaitqueue_active(&vcpu->wq))
- swait_wake_interruptible(&vcpu->wq);
+ /*
+ * This memory barrier pairs with prepare_to_wait's set_current_state()
+ */
+ smp_mb();
+ if (swait_active(&vcpu->wq))
+ swake_up(&vcpu->wq);
mmput(mm);
kvm_put_kvm(vcpu->kvm);
@@ -169,7 +173,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
* do alloc nowait since if we are going to sleep anyway we
* may as well sleep faulting in page
*/
- work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT);
+ work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT | __GFP_NOWARN);
if (!work)
return 0;