summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2013-02-27 17:16:38 +0100
committerJames Hogan <james.hogan@imgtec.com>2013-03-15 14:19:54 +0100
commitc43ca04b5e7854b3996f84a495e4553941e76266 (patch)
tree73cd4ed7b8ef214b8d9cd366611b566303628a2e
parentmetag: perf: fix core internal / perf channel mux (diff)
downloadlinux-c43ca04b5e7854b3996f84a495e4553941e76266.tar.xz
linux-c43ca04b5e7854b3996f84a495e4553941e76266.zip
metag: perf: fix wrap handling in delta calculation
When calculating the delta, mask with MAX_PERIOD (24 bits) to handle wrapping, which particularly happens with periodic sampling since the value is intentionally set so that it will overflow soon. 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>
-rw-r--r--arch/metag/kernel/perf/perf_event.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index f38bf6d4dc55..8096db2a550b 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -211,7 +211,7 @@ again:
/*
* Calculate the delta and add it to the counter.
*/
- delta = new_raw_count - prev_raw_count;
+ delta = (new_raw_count - prev_raw_count) & MAX_PERIOD;
local64_add(delta, &event->count);
}