diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 5a69abb05ac3..74c60021cdbc 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -1493,6 +1493,22 @@ do { \ | |||
1493 | return div64_u64(dividend, divisor); | 1493 | return div64_u64(dividend, divisor); |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | static void perf_event_stop(struct perf_event *event) | ||
1497 | { | ||
1498 | if (!event->pmu->stop) | ||
1499 | return event->pmu->disable(event); | ||
1500 | |||
1501 | return event->pmu->stop(event); | ||
1502 | } | ||
1503 | |||
1504 | static int perf_event_start(struct perf_event *event) | ||
1505 | { | ||
1506 | if (!event->pmu->start) | ||
1507 | return event->pmu->enable(event); | ||
1508 | |||
1509 | return event->pmu->start(event); | ||
1510 | } | ||
1511 | |||
1496 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | 1512 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) |
1497 | { | 1513 | { |
1498 | struct hw_perf_event *hwc = &event->hw; | 1514 | struct hw_perf_event *hwc = &event->hw; |
@@ -1513,9 +1529,9 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | |||
1513 | 1529 | ||
1514 | if (atomic64_read(&hwc->period_left) > 8*sample_period) { | 1530 | if (atomic64_read(&hwc->period_left) > 8*sample_period) { |
1515 | perf_disable(); | 1531 | perf_disable(); |
1516 | event->pmu->disable(event); | 1532 | perf_event_stop(event); |
1517 | atomic64_set(&hwc->period_left, 0); | 1533 | atomic64_set(&hwc->period_left, 0); |
1518 | event->pmu->enable(event); | 1534 | perf_event_start(event); |
1519 | perf_enable(); | 1535 | perf_enable(); |
1520 | } | 1536 | } |
1521 | } | 1537 | } |