summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2013-02-27 16:16:38 +0000
committerJames Hogan <james.hogan@imgtec.com>2013-03-15 13:20:07 +0000
commit2033dc54e6fffac01f6129c0038c2e78102cf59a (patch)
treed5c674bec7f7d941ef70d430ed95144d793d9256 /arch
parentc6ac1e6edacc7e1fb0405d61f95a797c6a712411 (diff)
downloadlinux-stable-2033dc54e6fffac01f6129c0038c2e78102cf59a.tar.gz
linux-stable-2033dc54e6fffac01f6129c0038c2e78102cf59a.tar.bz2
linux-stable-2033dc54e6fffac01f6129c0038c2e78102cf59a.zip
metag: perf: fix frequency sampling (dynamic period)
Frequency sampling mode dynamically adjusts the sample period so as to hit a particular frequency of samples. The sample period starts at just 1 and then gets increased if the interrupt rate is too high. This changed sample period needs handling in metag_pmu_event_set_period to update period_left (as the ARM equivalent does). The calculated delta also needs subtracting from period_left in metag_pmu_event_update in order to hit the conditional blocks in metag_pmu_event_set_period which update last_period (which is used in the dynamic sampling period calculation). Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/metag/kernel/perf/perf_event.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index 5bf984feaaa1..6210126de78a 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -214,6 +214,7 @@ again:
delta = (new_raw_count - prev_raw_count) & MAX_PERIOD;
local64_add(delta, &event->count);
+ local64_sub(delta, &hwc->period_left);
}
int metag_pmu_event_set_period(struct perf_event *event,
@@ -223,6 +224,10 @@ int metag_pmu_event_set_period(struct perf_event *event,
s64 period = hwc->sample_period;
int ret = 0;
+ /* The period may have been changed */
+ if (unlikely(period != hwc->last_period))
+ left += period - hwc->last_period;
+
if (unlikely(left <= -period)) {
left = period;
local64_set(&hwc->period_left, left);