Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Convert a few more per-CPU items to read-mostly ones

Both this_cpu_off and cpu_info aren't getting modified post boot, yet
are being accessed on enough code paths that grouping them with other
frequently read items seems desirable. For cpu_info this at the same
time implies removing the cache line alignment (which afaict became
pointless when it got converted to per-CPU data years ago).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Link: http://lkml.kernel.org/r/54589BD20200007800044A84@mail.emea.novell.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Jan Beulich and committed by
Thomas Gleixner
2c773dd3 fb7183ef

+5 -5
+1 -1
arch/x86/include/asm/percpu.h
··· 522 522 #include <asm-generic/percpu.h> 523 523 524 524 /* We can use this directly for local CPU (faster). */ 525 - DECLARE_PER_CPU(unsigned long, this_cpu_off); 525 + DECLARE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off); 526 526 527 527 #endif /* !__ASSEMBLY__ */ 528 528
+2 -2
arch/x86/include/asm/processor.h
··· 127 127 /* Index into per_cpu list: */ 128 128 u16 cpu_index; 129 129 u32 microcode; 130 - } __attribute__((__aligned__(SMP_CACHE_BYTES))); 130 + }; 131 131 132 132 #define X86_VENDOR_INTEL 0 133 133 #define X86_VENDOR_CYRIX 1 ··· 151 151 extern __u32 cpu_caps_set[NCAPINTS]; 152 152 153 153 #ifdef CONFIG_SMP 154 - DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 154 + DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info); 155 155 #define cpu_data(cpu) per_cpu(cpu_info, cpu) 156 156 #else 157 157 #define cpu_info boot_cpu_data
+1 -1
arch/x86/kernel/setup_percpu.c
··· 30 30 #define BOOT_PERCPU_OFFSET 0 31 31 #endif 32 32 33 - DEFINE_PER_CPU(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; 33 + DEFINE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; 34 34 EXPORT_PER_CPU_SYMBOL(this_cpu_off); 35 35 36 36 unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = {
+1 -1
arch/x86/kernel/smpboot.c
··· 99 99 DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map); 100 100 101 101 /* Per CPU bogomips and other parameters */ 102 - DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 102 + DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info); 103 103 EXPORT_PER_CPU_SYMBOL(cpu_info); 104 104 105 105 atomic_t init_deasserted;