[PATCH 1/2] KVM: use same boundary check for async_pf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit af585b921e5d ("KVM: Halt vcpu if page it tries to access is
swapped out") introduces async_pf.

The gfn hash table size is defined as:

	gfn_t gfns[roundup_pow_of_two(ASYNC_PF_PER_VCPU)];

And iterations in arch/x86/kvm/x86.c are checked with:

	i < roundup_pow_of_two(ASYNC_PF_PER_VCPU)

While the check in kvm_setup_async_pf() is:

	if (vcpu->async_pf.queued >= ASYNC_PF_PER_VCPU)

Generally this works good, while the check is not exact.

This patch adjust the check in kvm_setup_async_pf() to use the same
boundary as others.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
 virt/kvm/async_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c
index 23c2519c5b32..4f4f6eac88a4 100644
--- a/virt/kvm/async_pf.c
+++ b/virt/kvm/async_pf.c
@@ -182,7 +182,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
 {
 	struct kvm_async_pf *work;
 
-	if (vcpu->async_pf.queued >= ASYNC_PF_PER_VCPU)
+	if (vcpu->async_pf.queued >= roundup_pow_of_two(ASYNC_PF_PER_VCPU))
 		return 0;
 
 	/* setup delayed work */
-- 
2.15.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux