Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6ae41e7 authored by Alex Shi's avatar Alex Shi Committed by Tejun Heo
Browse files

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: default avatarAlex Shi <alex.shi@intel.com>
Acked-by: default avatarChristoph Lameter <cl@gentwo.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatar"H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 19e8d69c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ static inline void __user *arch_compat_alloc_user_space(long len)
		sp = task_pt_regs(current)->sp;
	} else {
		/* -128 for the x32 ABI redzone */
		sp = percpu_read(old_rsp) - 128;
		sp = this_cpu_read(old_rsp) - 128;
	}

	return (void __user *)round_down(sp - len, 16);
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ DECLARE_PER_CPU(struct task_struct *, current_task);

static __always_inline struct task_struct *get_current(void)
{
	return percpu_read_stable(current_task);
	return this_cpu_read_stable(current_task);
}

#define current get_current()
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <asm/mmu.h>

#include <linux/smp.h>
#include <linux/percpu.h>

static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *info)
{
+3 −3
Original line number Diff line number Diff line
@@ -290,14 +290,14 @@ static inline int __thread_has_fpu(struct task_struct *tsk)
static inline void __thread_clear_has_fpu(struct task_struct *tsk)
{
	tsk->thread.fpu.has_fpu = 0;
	percpu_write(fpu_owner_task, NULL);
	this_cpu_write(fpu_owner_task, NULL);
}

/* Must be paired with a 'clts' before! */
static inline void __thread_set_has_fpu(struct task_struct *tsk)
{
	tsk->thread.fpu.has_fpu = 1;
	percpu_write(fpu_owner_task, tsk);
	this_cpu_write(fpu_owner_task, tsk);
}

/*
@@ -344,7 +344,7 @@ typedef struct { int preload; } fpu_switch_t;
 */
static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
{
	return new == percpu_read_stable(fpu_owner_task) &&
	return new == this_cpu_read_stable(fpu_owner_task) &&
		cpu == new->thread.fpu.last_cpu;
}

+5 −4
Original line number Diff line number Diff line
@@ -35,14 +35,15 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);

#define __ARCH_IRQ_STAT

#define inc_irq_stat(member)	percpu_inc(irq_stat.member)
#define inc_irq_stat(member)	this_cpu_inc(irq_stat.member)

#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
#define local_softirq_pending()	this_cpu_read(irq_stat.__softirq_pending)

#define __ARCH_SET_SOFTIRQ_PENDING

#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
#define set_softirq_pending(x)	\
		this_cpu_write(irq_stat.__softirq_pending, (x))
#define or_softirq_pending(x)	this_cpu_or(irq_stat.__softirq_pending, (x))

extern void ack_bad_irq(unsigned int irq);

Loading