The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH RFC] perf, core: disable pmu while context rotation only if needed
Date: Tue, 22 Nov 2011 12:56:25 +0200	[thread overview]
Message-ID: <20111122105625.GC2557@redhat.com> (raw)
In-Reply-To: <1321361719.1421.67.camel@twins>

Hi Peter,

On Tue, Nov 15, 2011 at 01:55:18PM +0100, Peter Zijlstra wrote:
> On Tue, 2011-11-15 at 14:38 +0200, Gleb Natapov wrote:
> > On Tue, Nov 15, 2011 at 01:07:13PM +0100, Peter Zijlstra wrote:
> > > On Tue, 2011-11-15 at 13:34 +0200, Gleb Natapov wrote:
> > > > 
> > > > Currently pmu is disabled and re-enabled on each timer interrupt even
> > > > when no rotation or frequency adjustment is needed. On Intel CPU this
> > > > results in two writes into PERF_GLOBAL_CTRL MSR per tick. On bare metal
> > > > it does not cause significant slowdown, but when running perf in a virtual
> > > > machine it leads to 20% slowdown on my machine.
> > > 
> > > 
> > > I detest asymmetric locking like that, does something like the below
> > > also work for you?
> > > 
> > It does.
> 
> ok, great.
> 
> > >  
> > > +	if (!rotate && !freq)
> > > +		goto done;
> > > +
> > >  	perf_ctx_lock(cpuctx, cpuctx->task_ctx);
> > >  	perf_pmu_disable(cpuctx->ctx.pmu);
> > > +
> > > +	if (!freq)
> > > +		goto rotate;
> > > +
> > Why goto, why not
> > 
> > 	if (freq) {
> > >  	perf_ctx_adjust_freq(&cpuctx->ctx, interval);
> > >  	if (ctx)
> > >  		perf_ctx_adjust_freq(ctx, interval);
> >         }
> > 
> > And the same with next goto.
> 
> Because, uhm,. dunno. Let me make that if()s and commit the thing.
> Thanks!
Have you committed it somewhere? I do not see it in tip.git, but may be
I am looking in a wrong place.

--
			Gleb.

  reply	other threads:[~2011-11-22 10:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 11:34 [PATCH RFC] perf, core: disable pmu while context rotation only if needed Gleb Natapov
2011-11-15 12:07 ` Peter Zijlstra
2011-11-15 12:38   ` Gleb Natapov
2011-11-15 12:55     ` Peter Zijlstra
2011-11-22 10:56       ` Gleb Natapov [this message]
2011-11-22 10:59         ` Peter Zijlstra

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=20111122105625.GC2557@redhat.com \
    --to=gleb@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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