Re: [PATCH RFC 2/2] kvm PLE handler: Choose better candidate fordirected yield

From: Raghavendra K T
Date: Tue Jul 10 2012 - 07:48:40 EST


On 07/10/2012 04:00 AM, Rik van Riel wrote:
On 07/09/2012 02:20 AM, Raghavendra K T wrote:

+bool kvm_arch_vcpu_check_and_update_eligible(struct kvm_vcpu *vcpu)
+{
+ bool eligible;
+
+ eligible = !vcpu->arch.plo.pause_loop_exited ||
+ (vcpu->arch.plo.pause_loop_exited&&
+ vcpu->arch.plo.dy_eligible);
+
+ if (vcpu->arch.plo.pause_loop_exited)
+ vcpu->arch.plo.dy_eligible = !vcpu->arch.plo.dy_eligible;
+
+ return eligible;
+}

This is a nice simple mechanism to skip CPUs that were
eligible last time and had pause loop exits recently.

However, it could stand some documentation. Please
add a good comment explaining how and why the algorithm
works, when arch.plo.pause_loop_exited is cleared, etc...

It would be good to make this heuristic understandable
to people who look at the code for the first time.


Thanks for the review. will do more documentation.

--
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/