[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250409142417.GC9833@noisy.programming.kicks-ass.net>
Date: Wed, 9 Apr 2025 16:24:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: mark.barnett@....com
Cc: mingo@...hat.com, acme@...nel.org, namhyung@...nel.org,
irogers@...gle.com, ben.gainey@....com, deepak.surti@....com,
ak@...ux.intel.com, will@...nel.org, james.clark@....com,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, adrian.hunter@...el.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v4 3/5] perf: Allow adding fixed random jitter to the
sampling period
On Tue, Apr 08, 2025 at 06:15:28PM +0100, mark.barnett@....com wrote:
> @@ -10224,6 +10227,19 @@ static int __perf_event_overflow(struct perf_event *event,
> *
> * By ignoring the HF samples, we measure the actual period.
> */
> +
> + /*
> + * Apply optional jitter to the overall sample period
> + */
> + if (hwc->sample_period_state & PERF_SPS_HF_RAND
> + && !(hwc->sample_period_state & PERF_SPS_HF_SAMPLE)) {
Coding style nit: when breaking lines, the operator goes on the end of
the preceding line.
> + struct rnd_state *state = &get_cpu_var(sample_period_jitter_rnd);
> + u64 rand_period = 1 << event->attr.hf_sample_rand;
> +
> + sample_period -= rand_period / 2;
> + sample_period += prandom_u32_state(state) & (rand_period - 1);
> + }
> +
> if (hwc->sample_period_state & PERF_SPS_HF_ON) {
> u64 hf_sample_period = event->attr.hf_sample_period;
>
Powered by blists - more mailing lists