aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-11-02 05:35:35 -0400
committerAvi Kivity <avi@redhat.com>2011-01-12 04:29:01 -0500
commit15096ffceabb9693306982127348890886384aaa (patch)
tree10eb51dd343830a56783a1b364f775b0ed28afd2 /virt
parente6d53e3b0db7ae3641f01a2b2af1470fda86d10c (diff)
KVM: handle more completed apfs if possible
If it's no need to inject async #PF to PV guest we can handle more completed apfs at one time, so we can retry guest #PF as early as possible Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Acked-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/async_pf.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c
index 60df9e059e69..100c66ee0220 100644
--- a/virt/kvm/async_pf.c
+++ b/virt/kvm/async_pf.c
@@ -124,24 +124,24 @@ void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu)
124{ 124{
125 struct kvm_async_pf *work; 125 struct kvm_async_pf *work;
126 126
127 if (list_empty_careful(&vcpu->async_pf.done) || 127 while (!list_empty_careful(&vcpu->async_pf.done) &&
128 !kvm_arch_can_inject_async_page_present(vcpu)) 128 kvm_arch_can_inject_async_page_present(vcpu)) {
129 return; 129 spin_lock(&vcpu->async_pf.lock);
130 130 work = list_first_entry(&vcpu->async_pf.done, typeof(*work),
131 spin_lock(&vcpu->async_pf.lock); 131 link);
132 work = list_first_entry(&vcpu->async_pf.done, typeof(*work), link); 132 list_del(&work->link);
133 list_del(&work->link); 133 spin_unlock(&vcpu->async_pf.lock);
134 spin_unlock(&vcpu->async_pf.lock);
135 134
136 if (work->page) 135 if (work->page)
137 kvm_arch_async_page_ready(vcpu, work); 136 kvm_arch_async_page_ready(vcpu, work);
138 kvm_arch_async_page_present(vcpu, work); 137 kvm_arch_async_page_present(vcpu, work);
139 138
140 list_del(&work->queue); 139 list_del(&work->queue);
141 vcpu->async_pf.queued--; 140 vcpu->async_pf.queued--;
142 if (work->page) 141 if (work->page)
143 put_page(work->page); 142 put_page(work->page);
144 kmem_cache_free(async_pf_cache, work); 143 kmem_cache_free(async_pf_cache, work);
144 }
145} 145}
146 146
147int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn, 147int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,