Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163773
b: refs/heads/master
c: 850bc73
h: refs/heads/master
i:
  163771: 36f480e
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Sep 17, 2009
1 parent 28fe82f commit 8f7c3db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 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: 0ec04e16d08b69d8da46abbcfa3e3f2cd9738852
refs/heads/master: 850bc73ffcc99cddfb52bc23217c60810c508853
17 changes: 13 additions & 4 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3494,14 +3494,15 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
* Generic counter overflow handling, sampling.
*/

int perf_counter_overflow(struct perf_counter *counter, int nmi,
struct perf_sample_data *data)
static int __perf_counter_overflow(struct perf_counter *counter, int nmi,
int throttle, struct perf_sample_data *data)
{
int events = atomic_read(&counter->event_limit);
int throttle = counter->pmu->unthrottle != NULL;
struct hw_perf_counter *hwc = &counter->hw;
int ret = 0;

throttle = (throttle && counter->pmu->unthrottle != NULL);

if (!throttle) {
hwc->interrupts++;
} else {
Expand Down Expand Up @@ -3554,6 +3555,12 @@ int perf_counter_overflow(struct perf_counter *counter, int nmi,
return ret;
}

int perf_counter_overflow(struct perf_counter *counter, int nmi,
struct perf_sample_data *data)
{
return __perf_counter_overflow(counter, nmi, 1, data);
}

/*
* Generic software counter infrastructure
*/
Expand Down Expand Up @@ -3592,6 +3599,7 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
int nmi, struct perf_sample_data *data)
{
struct hw_perf_counter *hwc = &counter->hw;
int throttle = 0;
u64 overflow;

data->period = counter->hw.last_period;
Expand All @@ -3601,13 +3609,14 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
return;

for (; overflow; overflow--) {
if (perf_counter_overflow(counter, nmi, data)) {
if (__perf_counter_overflow(counter, nmi, throttle, data)) {
/*
* We inhibit the overflow from happening when
* hwc->interrupts == MAX_INTERRUPTS.
*/
break;
}
throttle = 0;
}
}

Expand Down

0 comments on commit 8f7c3db

Please sign in to comment.