perf: Shrink hw_perf_event
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 24 Jun 2010 10:35:12 +0000 (12:35 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 9 Sep 2010 18:46:30 +0000 (20:46 +0200)
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>
include/linux/perf_event.h
kernel/perf_event.c

index bf85733597ec7d6d6bf3f862093aba5ad7d5df6a..8cafa15af60d4b8e5ec8658a4d44ef22d9ab0a78 100644 (file)
@@ -529,7 +529,6 @@ struct hw_perf_event {
                        int             last_cpu;
                };
                struct { /* software */
-                       s64             remaining;
                        struct hrtimer  hrtimer;
                };
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
index 8ef4ba3bcb1f617966f8f050bb72cff597ac4098..1a6cdbf0d0911257fb4d2817b25a00122b96ea25 100644 (file)
@@ -4800,14 +4800,13 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
        hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        hwc->hrtimer.function = perf_swevent_hrtimer;
        if (hwc->sample_period) {
-               u64 period;
+               s64 period = local64_read(&hwc->period_left);
 
-               if (hwc->remaining) {
-                       if (hwc->remaining < 0)
+               if (period) {
+                       if (period < 0)
                                period = 10000;
-                       else
-                               period = hwc->remaining;
-                       hwc->remaining = 0;
+
+                       local64_set(&hwc->period_left, 0);
                } else {
                        period = max_t(u64, 10000, hwc->sample_period);
                }
@@ -4823,7 +4822,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event)
 
        if (hwc->sample_period) {
                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);
        }