mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
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>
This commit is contained in:
parent
e6d53e3b0d
commit
15096ffcea
@ -124,24 +124,24 @@ void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu)
|
|||||||
{
|
{
|
||||||
struct kvm_async_pf *work;
|
struct kvm_async_pf *work;
|
||||||
|
|
||||||
if (list_empty_careful(&vcpu->async_pf.done) ||
|
while (!list_empty_careful(&vcpu->async_pf.done) &&
|
||||||
!kvm_arch_can_inject_async_page_present(vcpu))
|
kvm_arch_can_inject_async_page_present(vcpu)) {
|
||||||
return;
|
spin_lock(&vcpu->async_pf.lock);
|
||||||
|
work = list_first_entry(&vcpu->async_pf.done, typeof(*work),
|
||||||
|
link);
|
||||||
|
list_del(&work->link);
|
||||||
|
spin_unlock(&vcpu->async_pf.lock);
|
||||||
|
|
||||||
spin_lock(&vcpu->async_pf.lock);
|
if (work->page)
|
||||||
work = list_first_entry(&vcpu->async_pf.done, typeof(*work), link);
|
kvm_arch_async_page_ready(vcpu, work);
|
||||||
list_del(&work->link);
|
kvm_arch_async_page_present(vcpu, work);
|
||||||
spin_unlock(&vcpu->async_pf.lock);
|
|
||||||
|
|
||||||
if (work->page)
|
list_del(&work->queue);
|
||||||
kvm_arch_async_page_ready(vcpu, work);
|
vcpu->async_pf.queued--;
|
||||||
kvm_arch_async_page_present(vcpu, work);
|
if (work->page)
|
||||||
|
put_page(work->page);
|
||||||
list_del(&work->queue);
|
kmem_cache_free(async_pf_cache, work);
|
||||||
vcpu->async_pf.queued--;
|
}
|
||||||
if (work->page)
|
|
||||||
put_page(work->page);
|
|
||||||
kmem_cache_free(async_pf_cache, work);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
|
int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
|
||||||
|
Loading…
Reference in New Issue
Block a user