[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANRm+CwES8w0=yoWO3uZ4kC-ZcMeRksQH_p3U-tYcwAvgFg4kw@mail.gmail.com>
Date: Mon, 24 May 2021 21:47:07 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH v4 2/5] KVM: X86: Bail out of direct yield in case of
under-committed scenarios
On Mon, 24 May 2021 at 21:42, Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 19/05/21 04:57, Wanpeng Li wrote:
> > Looks good. Hope Paolo can update the patch description when applying.:)
> >
> > "In case of under-committed scenarios, vCPU can get scheduling easily,
> > kvm_vcpu_yield_to add extra overhead, we can observe a lot of races
> > between vcpu->ready is true and yield fails due to p->state is
> > TASK_RUNNING. Let's bail out in such scenarios by checking the length
> > of current cpu runqueue, it can be treated as a hint of under-committed
> > instead of guaranteeing accuracy. 30%+ of directed-yield attempts can
> > avoid the expensive lookups in kvm_sched_yield() in an under-committed
> > scenario. "
> >
>
> Here is what I used:
>
> 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.
Thanks Paolo! :)
Wanpeng
Powered by blists - more mailing lists