diff options
| -rw-r--r-- | include/linux/perf_event.h | 1 | ||||
| -rw-r--r-- | kernel/perf_event.c | 13 |
2 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index bf85733597ec..8cafa15af60d 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -529,7 +529,6 @@ struct hw_perf_event { | |||
| 529 | int last_cpu; | 529 | int last_cpu; |
| 530 | }; | 530 | }; |
| 531 | struct { /* software */ | 531 | struct { /* software */ |
| 532 | s64 remaining; | ||
| 533 | struct hrtimer hrtimer; | 532 | struct hrtimer hrtimer; |
| 534 | }; | 533 | }; |
| 535 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 534 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 8ef4ba3bcb1f..1a6cdbf0d091 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -4800,14 +4800,13 @@ static void perf_swevent_start_hrtimer(struct perf_event *event) | |||
| 4800 | hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 4800 | hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
| 4801 | hwc->hrtimer.function = perf_swevent_hrtimer; | 4801 | hwc->hrtimer.function = perf_swevent_hrtimer; |
| 4802 | if (hwc->sample_period) { | 4802 | if (hwc->sample_period) { |
| 4803 | u64 period; | 4803 | s64 period = local64_read(&hwc->period_left); |
| 4804 | 4804 | ||
| 4805 | if (hwc->remaining) { | 4805 | if (period) { |
| 4806 | if (hwc->remaining < 0) | 4806 | if (period < 0) |
| 4807 | period = 10000; | 4807 | period = 10000; |
| 4808 | else | 4808 | |
| 4809 | period = hwc->remaining; | 4809 | local64_set(&hwc->period_left, 0); |
| 4810 | hwc->remaining = 0; | ||
| 4811 | } else { | 4810 | } else { |
| 4812 | period = max_t(u64, 10000, hwc->sample_period); | 4811 | period = max_t(u64, 10000, hwc->sample_period); |
| 4813 | } | 4812 | } |
| @@ -4823,7 +4822,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event) | |||
| 4823 | 4822 | ||
| 4824 | if (hwc->sample_period) { | 4823 | if (hwc->sample_period) { |
| 4825 | ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer); | 4824 | ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer); |
| 4826 | hwc->remaining = ktime_to_ns(remaining); | 4825 | local64_set(&hwc->period_left, ktime_to_ns(remaining)); |
| 4827 | 4826 | ||
| 4828 | hrtimer_cancel(&hwc->hrtimer); | 4827 | hrtimer_cancel(&hwc->hrtimer); |
| 4829 | } | 4828 | } |
