kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <kernellwp@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, kvm <kvm@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: [PATCH v2] sched/nohz: Optimize get_nohz_timer_target()
Date: Wed, 23 Oct 2019 16:16:55 +0800	[thread overview]
Message-ID: <CANRm+CxUpwZ9KwOcQp=Ok64giyjjcJOGb2=zU6vayQzLqYvpXQ@mail.gmail.com> (raw)
In-Reply-To: <20190628011012.GA19488@lerouge>

On Fri, 28 Jun 2019 at 09:10, Frederic Weisbecker <frederic@kernel.org> wrote:
>
> On Fri, Jun 28, 2019 at 08:43:12AM +0800, Wanpeng Li wrote:
> > From: Wanpeng Li <wanpengli@tencent.com>
> >
> > On a machine, cpu 0 is used for housekeeping, the other 39 cpus in the
> > same socket are in nohz_full mode. We can observe huge time burn in the
> > loop for seaching nearest busy housekeeper cpu by ftrace.
> >
> >   2)               |       get_nohz_timer_target() {
> >   2)   0.240 us    |         housekeeping_test_cpu();
> >   2)   0.458 us    |         housekeeping_test_cpu();
> >
> >   ...
> >
> >   2)   0.292 us    |         housekeeping_test_cpu();
> >   2)   0.240 us    |         housekeeping_test_cpu();
> >   2)   0.227 us    |         housekeeping_any_cpu();
> >   2) + 43.460 us   |       }
> >
> > This patch optimizes the searching logic by finding a nearest housekeeper
> > cpu in the housekeeping cpumask, it can minimize the worst searching time
> > from ~44us to < 10us in my testing. In addition, the last iterated busy
> > housekeeper can become a random candidate while current CPU is a better
> > fallback if it is a housekeeper.
> >
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Frederic Weisbecker <frederic@kernel.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
>
> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

Hi Thomas,

I didn't see your refactor to get_nohz_timer_target() which you
mentioned in IRC after four months, I can observe cyclictest drop from
4~5us to 8us in kvm guest(we offload the lapic timer emulation to
housekeeping cpu to avoid timer fire external interrupt on the pCPU
which vCPU resident incur a vCPU vmexit) w/o this patch in the case of
there is no busy housekeeping cpu. The score can be recovered after I
give stress to create a busy housekeeping cpu.

Could you consider applying this patch for temporary since I'm not
sure when the refactor can be ready.

    Wanpeng

       reply	other threads:[~2019-10-23  8:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1561682593-12071-1-git-send-email-wanpengli@tencent.com>
     [not found] ` <20190628011012.GA19488@lerouge>
2019-10-23  8:16   ` Wanpeng Li [this message]
2019-10-23  8:29     ` [PATCH v2] sched/nohz: Optimize get_nohz_timer_target() Thomas Gleixner
2019-10-23  9:25       ` Wanpeng Li
2020-01-06  6:21       ` Wanpeng Li
2020-01-10 14:12         ` Thomas Gleixner
2020-01-13  1:32           ` Wanpeng Li

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='CANRm+CxUpwZ9KwOcQp=Ok64giyjjcJOGb2=zU6vayQzLqYvpXQ@mail.gmail.com' \
    --to=kernellwp@gmail.com \
    --cc=frederic@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).