From: Peter Zijlstra <peterz@infradead.org>
To: mark.barnett@arm.com
Cc: mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
irogers@google.com, ben.gainey@arm.com, deepak.surti@arm.com,
ak@linux.intel.com, will@kernel.org, james.clark@arm.com,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, adrian.hunter@intel.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 3/5] perf: Allow adding fixed random jitter to the sampling period
Date: Wed, 9 Apr 2025 16:24:17 +0200 [thread overview]
Message-ID: <20250409142417.GC9833@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250408171530.140858-4-mark.barnett@arm.com>
On Tue, Apr 08, 2025 at 06:15:28PM +0100, mark.barnett@arm.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;
>
next prev parent reply other threads:[~2025-04-09 14:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 17:15 [PATCH v4 0/5] A mechanism for efficient support for per-function metrics mark.barnett
2025-04-08 17:15 ` [PATCH v4 1/5] perf: Record sample last_period before updating mark.barnett
2025-04-09 11:39 ` Ingo Molnar
2025-04-09 11:43 ` [tip: perf/core] perf/arch: Record sample last_period before updating on the x86 and PowerPC platforms tip-bot2 for Mark Barnett
2025-04-09 11:53 ` tip-bot2 for Mark Barnett
2025-04-08 17:15 ` [PATCH v4 2/5] perf: Allow periodic events to alternate between two sample periods mark.barnett
2025-04-08 17:15 ` [PATCH v4 3/5] perf: Allow adding fixed random jitter to the sampling period mark.barnett
2025-04-09 10:54 ` Ingo Molnar
2025-04-09 14:24 ` Peter Zijlstra [this message]
2025-04-08 17:15 ` [PATCH v4 4/5] tools/perf: Modify event parser to support hf-period term mark.barnett
2025-04-08 17:15 ` [PATCH v4 5/5] tools/perf: Modify event parser to support hf-rand term mark.barnett
2025-04-09 11:38 ` [PATCH v4 0/5] A mechanism for efficient support for per-function metrics Ingo Molnar
2025-04-11 11:07 ` Mark Barnett
2025-04-11 17:34 ` Ian Rogers
2025-04-12 20:42 ` Ingo Molnar
2025-04-12 20:38 ` Ingo Molnar
2025-04-09 14:29 ` Peter Zijlstra
2025-04-11 9:44 ` Mark Barnett
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=20250409142417.GC9833@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ben.gainey@arm.com \
--cc=deepak.surti@arm.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.barnett@arm.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=will@kernel.org \
/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
Powered by JetHome