x86/apic: Use this_cpu_ptr() in local_timer_interrupt()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 28 Aug 2017 06:47:24 +0000 (08:47 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 29 Aug 2017 09:42:24 +0000 (11:42 +0200)
Accessing the per cpu data via per_cpu(, smp_processor_id()) is
pointless. Use this_cpu_ptr() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170828064956.829552757@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/apic/apic.c

index 7a57b5418f6d9d7a547e085d54d5717cd007d98b..a33fa4442d14620ed6159f57261b1b986d6aa5cb 100644 (file)
@@ -988,8 +988,7 @@ void setup_secondary_APIC_clock(void)
  */
 static void local_apic_timer_interrupt(void)
 {
-       int cpu = smp_processor_id();
-       struct clock_event_device *evt = &per_cpu(lapic_events, cpu);
+       struct clock_event_device *evt = this_cpu_ptr(&lapic_events);
 
        /*
         * Normally we should not be here till LAPIC has been initialized but
@@ -1003,7 +1002,8 @@ static void local_apic_timer_interrupt(void)
         * spurious.
         */
        if (!evt->event_handler) {
-               pr_warning("Spurious LAPIC timer interrupt on cpu %d\n", cpu);
+               pr_warning("Spurious LAPIC timer interrupt on cpu %d\n",
+                          smp_processor_id());
                /* Switch it off */
                lapic_timer_shutdown(evt);
                return;