From: Peter Zijlstra <peterz@infradead.org>
To: mingo@elte.hu
Cc: eranian@google.com, linux-kernel@vger.kernel.org
Subject: [PATCH 5/4] perf_events: Fix sample_period transfer on inherit
Date: Fri, 29 Jan 2010 09:04:26 +0100 [thread overview]
Message-ID: <1264752266.4283.2121.camel@laptop> (raw)
In-Reply-To: <20100127220745.027096123@chello.nl>
Subject: perf_events: Fix sample_period transfer on inherit
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Thu Jan 28 12:34:07 CET 2010
One problem with frequency driven counters is that we cannot predict
the rate at which they trigger, therefore we have to start them at
period=1, this causes a ramp up effect. However, if we fail to
propagate the stable state on fork each new child will have to ramp up
again. This can lead to significant artifacts in sample data.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/perf_event.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
Index: linux-2.6/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/kernel/perf_event.c
+++ linux-2.6/kernel/perf_event.c
@@ -5011,8 +5011,15 @@ inherit_event(struct perf_event *parent_
else
child_event->state = PERF_EVENT_STATE_OFF;
- if (parent_event->attr.freq)
- child_event->hw.sample_period = parent_event->hw.sample_period;
+ if (parent_event->attr.freq) {
+ u64 sample_period = parent_event->hw.sample_period;
+ struct hw_perf_event *hwc = &child_event->hw;
+
+ hwc->sample_period = sample_period;
+ hwc->last_period = sample_period;
+
+ atomic64_set(&hwc->period_left, sample_period);
+ }
child_event->overflow_handler = parent_event->overflow_handler;
next prev parent reply other threads:[~2010-01-29 8:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 22:07 [PATCH 0/4] perf x86 fixes Peter Zijlstra
2010-01-27 22:07 ` [PATCH 1/4] perf_events: x86: Fix event constraint masks Peter Zijlstra
2010-01-29 9:29 ` [tip:perf/core] perf_events, " tip-bot for Peter Zijlstra
2010-01-27 22:07 ` [PATCH 2/4] perf_events: x86: Clean up hw_perf_*_all() implementation Peter Zijlstra
2010-01-29 9:30 ` [tip:perf/core] perf_events, " tip-bot for Peter Zijlstra
2010-01-27 22:07 ` [PATCH 3/4] perf_events: x86: Implement westmere support Peter Zijlstra
2010-01-29 9:30 ` [tip:perf/core] perf_events, x86: Implement Intel Westmere support tip-bot for Peter Zijlstra
2010-01-27 22:07 ` [PATCH 4/4] perf_events: x86: Remove spurious counter reset from x86_pmu_enable() Peter Zijlstra
2010-01-29 9:30 ` [tip:perf/core] perf_events, " tip-bot for Peter Zijlstra
2010-01-29 7:55 ` [PATCH 0/4] perf x86 fixes Ingo Molnar
2010-01-29 8:04 ` Peter Zijlstra [this message]
2010-01-29 9:30 ` [tip:perf/core] perf_events: Fix sample_period transfer on inherit tip-bot for 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=1264752266.4283.2121.camel@laptop \
--to=peterz@infradead.org \
--cc=eranian@google.com \
--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
all inboxes | Powered by JetHome®