Re: [PATCH RFC V5 3/3] kvm: Choose better candidate for directedyield
From: Raghavendra K T
Date: Wed Jul 18 2012 - 10:41:37 EST
On 07/18/2012 07:08 PM, Raghavendra K T wrote:
From: Raghavendra K T<raghavendra.kt@xxxxxxxxxxxxxxxxxx>
+bool kvm_vcpu_eligible_for_directed_yield(struct kvm_vcpu *vcpu)
+{
+ bool eligible;
+
+ eligible = !vcpu->spin_loop.in_spin_loop ||
+ (vcpu->spin_loop.in_spin_loop&&
+ vcpu->spin_loop.dy_eligible);
+
+ if (vcpu->spin_loop.in_spin_loop)
+ vcpu->spin_loop.dy_eligible = !vcpu->spin_loop.dy_eligible;
+
+ return eligible;
+}
I should have added a comment like:
Since algorithm is based on heuristics, accessing another vcpu data
without locking does not harm. It may result in trying to yield to same
VCPU, fail and continue with next and so on.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/