KVM: Choose better candidate for directed yield
authorRaghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Thu, 19 Jul 2012 09:47:52 +0000 (15:17 +0530)
committerAvi Kivity <avi@redhat.com>
Mon, 23 Jul 2012 10:02:37 +0000 (13:02 +0300)
commit06e48c510aa37f6e791602e6420422ea7071fe94
tree083e13a1a1b58d32369adc6eaa42c2a22d17d95d
parent4c088493c8d07e4e27bad53a99dcfdc14cdf45f8
KVM: Choose better candidate for directed yield

Currently, on a large vcpu guests, there is a high probability of
yielding to the same vcpu who had recently done a pause-loop exit or
cpu relax intercepted. Such a yield can lead to the vcpu spinning
again and hence degrade the performance.

The patchset keeps track of the pause loop exit/cpu relax interception
and gives chance to a vcpu which:
 (a) Has not done pause loop exit or cpu relax intercepted at all
     (probably he is preempted lock-holder)
 (b) Was skipped in last iteration because it did pause loop exit or
     cpu relax intercepted, and probably has become eligible now
     (next eligible lock holder)

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> # on s390x
Signed-off-by: Avi Kivity <avi@redhat.com>
include/linux/kvm_host.h
virt/kvm/kvm_main.c