x86: replace percpu_xxx funcs with this_cpu_xxx
Since percpu_xxx() serial functions are duplicated with this_cpu_xxx(). Removing percpu_xxx() definition and replacing them by this_cpu_xxx() in code. There is no function change in this patch, just preparation for later percpu_xxx serial function removing. On x86 machine the this_cpu_xxx() serial functions are same as __this_cpu_xxx() without no unnecessary premmpt enable/disable. Thanks for Stephen Rothwell, he found and fixed a i386 build error in the patch. Also thanks for Andrew Morton, he kept updating the patchset in Linus' tree. Signed-off-by: Alex Shi <alex.shi@intel.com> Acked-by: Christoph Lameter <cl@gentwo.org> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Tejun Heo <tj@kernel.org>
此提交包含在:
@@ -1185,7 +1185,7 @@ void __cpuinit cpu_init(void)
|
||||
oist = &per_cpu(orig_ist, cpu);
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
if (cpu != 0 && percpu_read(numa_node) == 0 &&
|
||||
if (cpu != 0 && this_cpu_read(numa_node) == 0 &&
|
||||
early_cpu_to_node(cpu) != NUMA_NO_NODE)
|
||||
set_numa_node(early_cpu_to_node(cpu));
|
||||
#endif
|
||||
|
@@ -583,7 +583,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
|
||||
struct mce m;
|
||||
int i;
|
||||
|
||||
percpu_inc(mce_poll_count);
|
||||
this_cpu_inc(mce_poll_count);
|
||||
|
||||
mce_gather_info(&m, NULL);
|
||||
|
||||
@@ -1015,7 +1015,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
|
||||
|
||||
atomic_inc(&mce_entry);
|
||||
|
||||
percpu_inc(mce_exception_count);
|
||||
this_cpu_inc(mce_exception_count);
|
||||
|
||||
if (!banks)
|
||||
goto out;
|
||||
|
@@ -88,7 +88,7 @@ void kernel_fpu_begin(void)
|
||||
__thread_clear_has_fpu(me);
|
||||
/* We do 'stts()' in kernel_fpu_end() */
|
||||
} else {
|
||||
percpu_write(fpu_owner_task, NULL);
|
||||
this_cpu_write(fpu_owner_task, NULL);
|
||||
clts();
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/percpu.h>
|
||||
|
||||
#include <asm/apic.h>
|
||||
#include <asm/nmi.h>
|
||||
|
@@ -241,16 +241,16 @@ static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LA
|
||||
|
||||
static inline void enter_lazy(enum paravirt_lazy_mode mode)
|
||||
{
|
||||
BUG_ON(percpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
|
||||
BUG_ON(this_cpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
|
||||
|
||||
percpu_write(paravirt_lazy_mode, mode);
|
||||
this_cpu_write(paravirt_lazy_mode, mode);
|
||||
}
|
||||
|
||||
static void leave_lazy(enum paravirt_lazy_mode mode)
|
||||
{
|
||||
BUG_ON(percpu_read(paravirt_lazy_mode) != mode);
|
||||
BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode);
|
||||
|
||||
percpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
|
||||
this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
|
||||
}
|
||||
|
||||
void paravirt_enter_lazy_mmu(void)
|
||||
@@ -267,7 +267,7 @@ void paravirt_start_context_switch(struct task_struct *prev)
|
||||
{
|
||||
BUG_ON(preemptible());
|
||||
|
||||
if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
|
||||
if (this_cpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
|
||||
arch_leave_lazy_mmu_mode();
|
||||
set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
|
||||
}
|
||||
@@ -289,7 +289,7 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
|
||||
if (in_interrupt())
|
||||
return PARAVIRT_LAZY_NONE;
|
||||
|
||||
return percpu_read(paravirt_lazy_mode);
|
||||
return this_cpu_read(paravirt_lazy_mode);
|
||||
}
|
||||
|
||||
void arch_flush_lazy_mmu_mode(void)
|
||||
|
@@ -377,7 +377,7 @@ static inline void play_dead(void)
|
||||
#ifdef CONFIG_X86_64
|
||||
void enter_idle(void)
|
||||
{
|
||||
percpu_write(is_idle, 1);
|
||||
this_cpu_write(is_idle, 1);
|
||||
atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
|
||||
}
|
||||
|
||||
|
@@ -302,7 +302,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
|
||||
|
||||
switch_fpu_finish(next_p, fpu);
|
||||
|
||||
percpu_write(current_task, next_p);
|
||||
this_cpu_write(current_task, next_p);
|
||||
|
||||
return prev_p;
|
||||
}
|
||||
|
@@ -237,7 +237,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
|
||||
current->thread.usersp = new_sp;
|
||||
regs->ip = new_ip;
|
||||
regs->sp = new_sp;
|
||||
percpu_write(old_rsp, new_sp);
|
||||
this_cpu_write(old_rsp, new_sp);
|
||||
regs->cs = _cs;
|
||||
regs->ss = _ss;
|
||||
regs->flags = X86_EFLAGS_IF;
|
||||
@@ -359,11 +359,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
|
||||
/*
|
||||
* Switch the PDA and FPU contexts.
|
||||
*/
|
||||
prev->usersp = percpu_read(old_rsp);
|
||||
percpu_write(old_rsp, next->usersp);
|
||||
percpu_write(current_task, next_p);
|
||||
prev->usersp = this_cpu_read(old_rsp);
|
||||
this_cpu_write(old_rsp, next->usersp);
|
||||
this_cpu_write(current_task, next_p);
|
||||
|
||||
percpu_write(kernel_stack,
|
||||
this_cpu_write(kernel_stack,
|
||||
(unsigned long)task_stack_page(next_p) +
|
||||
THREAD_SIZE - KERNEL_STACK_OFFSET);
|
||||
|
||||
|
新增問題並參考
封鎖使用者