x86/percpu: Move cpu_number next to current_task
Also add cpu_number to the pcpu_hot structure, it is often referenced and this cacheline is there. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220915111145.387678283@infradead.org
This commit is contained in:
parent
64701838bf
commit
7443b296e6
|
@ -16,6 +16,7 @@ struct pcpu_hot {
|
||||||
struct {
|
struct {
|
||||||
struct task_struct *current_task;
|
struct task_struct *current_task;
|
||||||
int preempt_count;
|
int preempt_count;
|
||||||
|
int cpu_number;
|
||||||
};
|
};
|
||||||
u8 pad[64];
|
u8 pad[64];
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
#define _ASM_X86_SMP_H
|
#define _ASM_X86_SMP_H
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
#include <asm/percpu.h>
|
|
||||||
|
|
||||||
#include <asm/thread_info.h>
|
|
||||||
#include <asm/cpumask.h>
|
#include <asm/cpumask.h>
|
||||||
|
#include <asm/current.h>
|
||||||
|
#include <asm/thread_info.h>
|
||||||
|
|
||||||
extern int smp_num_siblings;
|
extern int smp_num_siblings;
|
||||||
extern unsigned int num_processors;
|
extern unsigned int num_processors;
|
||||||
|
@ -19,7 +19,6 @@ DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);
|
||||||
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_l2c_shared_map);
|
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_l2c_shared_map);
|
||||||
DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id);
|
DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id);
|
||||||
DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_l2c_id);
|
DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_l2c_id);
|
||||||
DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
|
|
||||||
|
|
||||||
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
|
||||||
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid);
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid);
|
||||||
|
@ -150,11 +149,10 @@ __visible void smp_call_function_single_interrupt(struct pt_regs *r);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is needed by all SMP systems. It must _always_ be valid
|
* This function is needed by all SMP systems. It must _always_ be valid
|
||||||
* from the initial startup. We map APIC_BASE very early in page_setup(),
|
* from the initial startup.
|
||||||
* so this is correct in the x86 case.
|
|
||||||
*/
|
*/
|
||||||
#define raw_smp_processor_id() this_cpu_read(cpu_number)
|
#define raw_smp_processor_id() this_cpu_read(pcpu_hot.cpu_number)
|
||||||
#define __smp_processor_id() __this_cpu_read(cpu_number)
|
#define __smp_processor_id() __this_cpu_read(pcpu_hot.cpu_number)
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
extern int safe_smp_processor_id(void);
|
extern int safe_smp_processor_id(void);
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#include <asm/cpu.h>
|
#include <asm/cpu.h>
|
||||||
#include <asm/stackprotector.h>
|
#include <asm/stackprotector.h>
|
||||||
|
|
||||||
DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number);
|
|
||||||
EXPORT_PER_CPU_SYMBOL(cpu_number);
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
#define BOOT_PERCPU_OFFSET ((unsigned long)__per_cpu_load)
|
#define BOOT_PERCPU_OFFSET ((unsigned long)__per_cpu_load)
|
||||||
#else
|
#else
|
||||||
|
@ -172,7 +169,7 @@ void __init setup_per_cpu_areas(void)
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
per_cpu_offset(cpu) = delta + pcpu_unit_offsets[cpu];
|
per_cpu_offset(cpu) = delta + pcpu_unit_offsets[cpu];
|
||||||
per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
|
per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
|
||||||
per_cpu(cpu_number, cpu) = cpu;
|
per_cpu(pcpu_hot.cpu_number, cpu) = cpu;
|
||||||
setup_percpu_segment(cpu);
|
setup_percpu_segment(cpu);
|
||||||
/*
|
/*
|
||||||
* Copy data used in early init routines from the
|
* Copy data used in early init routines from the
|
||||||
|
|
Loading…
Reference in New Issue