Commit fa407f35 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ad5133b7
...@@ -529,7 +529,6 @@ struct hw_perf_event { ...@@ -529,7 +529,6 @@ struct hw_perf_event {
int last_cpu; int last_cpu;
}; };
struct { /* software */ struct { /* software */
s64 remaining;
struct hrtimer hrtimer; struct hrtimer hrtimer;
}; };
#ifdef CONFIG_HAVE_HW_BREAKPOINT #ifdef CONFIG_HAVE_HW_BREAKPOINT
......
...@@ -4800,14 +4800,13 @@ static void perf_swevent_start_hrtimer(struct perf_event *event) ...@@ -4800,14 +4800,13 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swevent_hrtimer; hwc->hrtimer.function = perf_swevent_hrtimer;
if (hwc->sample_period) { if (hwc->sample_period) {
u64 period; s64 period = local64_read(&hwc->period_left);
if (hwc->remaining) { if (period) {
if (hwc->remaining < 0) if (period < 0)
period = 10000; period = 10000;
else
period = hwc->remaining; local64_set(&hwc->period_left, 0);
hwc->remaining = 0;
} else { } else {
period = max_t(u64, 10000, hwc->sample_period); period = max_t(u64, 10000, hwc->sample_period);
} }
...@@ -4823,7 +4822,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event) ...@@ -4823,7 +4822,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event)
if (hwc->sample_period) { if (hwc->sample_period) {
ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer); ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
hwc->remaining = ktime_to_ns(remaining); local64_set(&hwc->period_left, ktime_to_ns(remaining));
hrtimer_cancel(&hwc->hrtimer); hrtimer_cancel(&hwc->hrtimer);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment