Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147449
b: refs/heads/master
c: ec3232b
h: refs/heads/master
i:
  147447: df72c8e
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 15, 2009
1 parent 7be6901 commit 9d2a22f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a853e36871b533ccc3f3c5bdd5cd0d867043a00
refs/heads/master: ec3232bdf8518bea8410f0027f870b24d3aa8753
9 changes: 6 additions & 3 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ static u64
x86_perf_counter_update(struct perf_counter *counter,
struct hw_perf_counter *hwc, int idx)
{
u64 prev_raw_count, new_raw_count, delta;
int shift = 64 - x86_pmu.counter_bits;
u64 prev_raw_count, new_raw_count;
s64 delta;

/*
* Careful: an NMI might modify the previous counter value.
Expand All @@ -161,9 +163,10 @@ x86_perf_counter_update(struct perf_counter *counter,
* (counter-)time and add that to the generic counter.
*
* Careful, not all hw sign-extends above the physical width
* of the count, so we do that by clipping the delta to 32 bits:
* of the count.
*/
delta = (u64)(u32)((s32)new_raw_count - (s32)prev_raw_count);
delta = (new_raw_count << shift) - (prev_raw_count << shift);
delta >>= shift;

atomic64_add(delta, &counter->count);
atomic64_sub(delta, &hwc->period_left);
Expand Down

0 comments on commit 9d2a22f

Please sign in to comment.