public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	paulus@samba.org, fweisbec@gmail.com,
	perfmon2-devel@lists.sf.net, robert.richter@amd.com,
	eranian@gmail.com, davem@davemloft.net,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH] perf_events: add sampling period randomization support (v2)
Date: Thu, 4 Mar 2010 22:13:32 +0100	[thread overview]
Message-ID: <20100304211332.GA3643@elte.hu> (raw)
In-Reply-To: <bd4cb8901003040925t28ddcc5bmfce11dcfa8b9b0ba@mail.gmail.com>


* Stephane Eranian <eranian@google.com> wrote:

> On Thu, Mar 4, 2010 at 3:32 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * eranian@google.com <eranian@google.com> wrote:
> >
> >> This patch adds support for randomizing the sampling period. ??Randomization
> >> is very useful to mitigate the bias that exists with sampling. The random
> >> number generator does not need to be sophisticated. This patch uses the
> >> builtin random32() generator.
> >
> >> + ?? ?? if (width > 63 || attr->freq)
> >> + ?? ?? ?? ?? ?? ?? return -EINVAL;
> >
> > Why not for freq counters? Those are semi-randomized already, but it might
> > make sense to make them 'more' randomized in special circumstances. That would
> > also allow us to enable the randomization in perf top and perf record, by
> > default.
> >
>
> What's the goal of freq?
> Achieve and maintain the target interrupt/rate.
> In doing so, it has to adjust the period (not randomly).

No, the goal of auto-freq is to keep a steady average rate of sampling.

There is no requirement to keep it 'steady' - each sample comes with a 
specific weight.

> Randomization may prevent achieving the rate, or it may slow
> it down. What's the value add of that?

Why do you assume that the two are incompatible? We can randomize auto-freq 
and still have a perfectly stable average rate.

We know how long each sample takes so the result is precise, via 
PERF_SAMPLE_PERIOD.

> > Without that we'd have no immediate usecase and no way to ensure that this 
> > code works as intended.
>
> Why?
>
> With perf you also have fixed sampling period (-c option), you simply need 
> to express the fact you want it randomized.

-c is legacy in essence. The default is auto-freq and i doubt anyone uses -c 
anymore.

Why would they use it? Auto-freq is so much more convenient - it adapts to the 
workload and achieves a steady state of sampling, regardless of how frequent 
the hardware events are and regardless of how dynamic the workload itself is.

	Ingo

  reply	other threads:[~2010-03-04 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03  0:21 [PATCH] perf_events: add sampling period randomization support (v2) eranian
2010-03-04  8:52 ` Robert Richter
2010-03-04 11:32 ` Ingo Molnar
2010-03-04 17:25   ` Stephane Eranian
2010-03-04 21:13     ` Ingo Molnar [this message]
2010-03-05  2:34       ` Stephane Eranian
2010-03-11 11:52         ` Ingo Molnar

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=20100304211332.GA3643@elte.hu \
    --to=mingo@elte.hu \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    /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