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, 11 Mar 2010 12:52:14 +0100	[thread overview]
Message-ID: <20100311115214.GD31354@elte.hu> (raw)
In-Reply-To: <bd4cb8901003041834l61bc510er21c9da4de8639d9b@mail.gmail.com>


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

> On Thu, Mar 4, 2010 at 1:13 PM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * 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.
>
> rate of samples = rate of interrupts (if period < 32 bits on Intel).

What's your point? I corrected your statement which said that the goal of 
auto-freq was to maintain a target interrupt-rate and as such wouldnt be 
randomizable. So i said that auto-freq is slightly different from that: it 
provides a steady _average_ rate, and as such small amounts of randomization 
'fuzz' could still be injected - the auto-freq system would auto-correct the 
effects of that.

Think of it as a dynamic steady-state equilibrium with noise injected. If the 
noise isnt too brutal and the system can adapt, the average sampling rate 
doesnt change.

> > 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.
>
> What would that buy you compared to what you already have?

The same goal as randomization in general: to decrease the chance for sampling 
artifacts that can occur due to the sampling frequency oscillating together 
with some internal workload parameter, skewing the sample.

	Ingo

      reply	other threads:[~2010-03-11 11:52 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
2010-03-05  2:34       ` Stephane Eranian
2010-03-11 11:52         ` Ingo Molnar [this message]

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=20100311115214.GD31354@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