• Wanpeng Li's avatar
    KVM: X86: Bail out of direct yield in case of under-committed scenarios · 72b268a8
    Wanpeng Li authored
    In case of under-committed scenarios, vCPUs can be scheduled easily;
    kvm_vcpu_yield_to adds extra overhead, and it is also common to see
    when vcpu->ready is true but yield later failing due to p->state is
    TASK_RUNNING.
    
    Let's bail out in such scenarios by checking the length of current cpu
    runqueue, which can be treated as a hint of under-committed instead of
    guarantee of accuracy. 30%+ of directed-yield attempts can now avoid
    the expensive lookups in kvm_sched_yield() in an under-committed scenario.
    Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
    Message-Id: <1621339235-11131-2-git-send-email-wanpengli@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    72b268a8
x86.c 312 KB