mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH] KVM: Disable wake-affine vCPU process to mitigate lock holder preemption
Date: Tue, 30 Jul 2019 14:09:39 +0200	[thread overview]
Message-ID: <20190730120939.GM31381@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1564479235-25074-1-git-send-email-wanpengli@tencent.com>

On Tue, Jul 30, 2019 at 05:33:55PM +0800, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Wake-affine is a feature inside scheduler which we attempt to make processes 
> running closely, it gains benefit mostly from cache-hit. When waker tries 
> to wakup wakee, it needs to select cpu to run wakee, wake affine heuristic 
> mays select the cpu which waker is running on currently instead of the prev 
> cpu which wakee was last time running. 
> 
> However, in multiple VMs over-subscribe virtualization scenario, it increases 
> the probability to incur vCPU stacking which means that the sibling vCPUs from 
> the same VM will be stacked on one pCPU. I test three 80 vCPUs VMs running on 
> one 80 pCPUs Skylake server(PLE is supported), the ebizzy score can increase 17% 
> after disabling wake-affine for vCPU process. 
> 
> When qemu/other vCPU inject virtual interrupt to guest through waking up one 
> sleeping vCPU, it increases the probability to stack vCPUs/qemu by scheduler
> wake-affine. vCPU stacking issue can greately inceases the lock synchronization 
> latency in a virtualized environment. This patch disables wake-affine vCPU 
> process to mitigtate lock holder preemption.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>  include/linux/sched.h | 1 +
>  kernel/sched/fair.c   | 3 +++
>  virt/kvm/kvm_main.c   | 1 +
>  3 files changed, 5 insertions(+)

> index 036be95..18eb1fa 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5428,6 +5428,9 @@ static int wake_wide(struct task_struct *p)
>  	unsigned int slave = p->wakee_flips;
>  	int factor = this_cpu_read(sd_llc_size);
>  
> +	if (unlikely(p->flags & PF_NO_WAKE_AFFINE))
> +		return 1;
> +
>  	if (master < slave)
>  		swap(master, slave);
>  	if (slave < factor || master < slave * factor)

I intensely dislike how you misrepresent this patch as a KVM patch.

Also the above is very much not the right place, even if this PF_flag
were to live.

  parent reply	other threads:[~2019-07-30 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  9:33 Wanpeng Li
2019-07-30 11:46 ` Paolo Bonzini
2019-08-01 12:39   ` Dario Faggioli
2019-07-30 12:09 ` Peter Zijlstra [this message]
2019-08-01 12:57 ` Dario Faggioli
2019-08-02  0:51   ` Wanpeng Li
2019-08-02  8:30   ` Christophe de Dinechin
2019-08-02  8:38   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190730120939.GM31381@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®