diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-06-24 06:35:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-09 14:46:30 -0400 |
commit | fa407f35e0298d841e4088f95a7f9cf6e725c6d5 (patch) | |
tree | 8ffb9141278688835de02e1940a8535c54a87cd7 /kernel/perf_event.c | |
parent | ad5133b7030d04ce7701aa7cbe98f561347c79c2 (diff) |
perf: Shrink hw_perf_event
Use hw_perf_event::period_left instead of hw_perf_event::remaining
and win back 8 bytes.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 13 |
1 files changed, 6 insertions, 7 deletions
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 | } |