Skip to content

Commit

Permalink
x86/oprofile: Use per_cpu() instead of __get_cpu_var()
Browse files Browse the repository at this point in the history
__get_cpu_var() calls smp_processor_id(). When the cpu id is already
known, instead use per_cpu() to avoid generating the id again.

Signed-off-by: Robert Richter <robert.richter@amd.com>
  • Loading branch information
Robert Richter committed Jul 20, 2009
1 parent 5e766e3 commit 82a2252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static void nmi_cpu_shutdown(void *dummy)
{
unsigned int v;
int cpu = smp_processor_id();
struct op_msrs *msrs = &__get_cpu_var(cpu_msrs);
struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);

/* restoring APIC_LVTPC can trigger an apic error because the delivery
* mode and vector nr combination can be illegal. That's by design: on
Expand All @@ -307,7 +307,7 @@ static void nmi_cpu_shutdown(void *dummy)
apic_write(APIC_LVTERR, v);
nmi_cpu_restore_registers(msrs);
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
__get_cpu_var(switch_index) = 0;
per_cpu(switch_index, cpu) = 0;
#endif
}

Expand Down

0 comments on commit 82a2252

Please sign in to comment.