Skip to content

Commit

Permalink
locking/core: Provide common cpu_relax_yield() definition
Browse files Browse the repository at this point in the history
No need to duplicate the same define everywhere. Since
the only user is stop-machine and the only provider is
s390, we can use a default implementation of cpu_relax_yield()
in sched.h.

Suggested-by: Russell King <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Acked-by: Russell King <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Noam Camus <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: linux-s390 <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
borntraeger authored and Ingo Molnar committed Nov 17, 2016
1 parent 43496d3 commit 6d0d287
Show file tree
Hide file tree
Showing 33 changed files with 5 additions and 38 deletions.
1 change: 0 additions & 1 deletion arch/alpha/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ unsigned long get_wchan(struct task_struct *p);
((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#define ARCH_HAS_PREFETCH
#define ARCH_HAS_PREFETCHW
Expand Down
3 changes: 0 additions & 3 deletions arch/arc/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,12 @@ struct task_struct;
#ifndef CONFIG_EZNPS_MTM_EXT

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#else

#define cpu_relax() \
__asm__ __volatile__ (".word %0" : : "i"(CTOP_INST_SCHD_RW) : "memory")

#define cpu_relax_yield() cpu_relax()

#endif

#define copy_segments(tsk, mm) do { } while (0)
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ unsigned long get_wchan(struct task_struct *p);
#define cpu_relax() barrier()
#endif

#define cpu_relax_yield() cpu_relax()

#define task_pt_regs(p) \
((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)

Expand Down
2 changes: 0 additions & 2 deletions arch/arm64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ static inline void cpu_relax(void)
asm volatile("yield" ::: "memory");
}

#define cpu_relax_yield() cpu_relax()

/* Thread switching */
extern struct task_struct *cpu_switch_to(struct task_struct *prev,
struct task_struct *next);
Expand Down
1 change: 0 additions & 1 deletion arch/avr32/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ extern struct avr32_cpuinfo boot_cpu_data;
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()
#define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory")

struct cpu_context {
Expand Down
1 change: 0 additions & 1 deletion arch/blackfin/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)

#define cpu_relax() smp_mb()
#define cpu_relax_yield() cpu_relax()

/* Get the Silicon Revision of the chip */
static inline uint32_t __pure bfin_revid(void)
Expand Down
1 change: 0 additions & 1 deletion arch/c6x/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(task) (task_pt_regs(task)->sp)

#define cpu_relax() do { } while (0)
#define cpu_relax_yield() cpu_relax()

extern const struct seq_operations cpuinfo_op;

Expand Down
1 change: 0 additions & 1 deletion arch/cris/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ static inline void release_thread(struct task_struct *dead_task)
#define init_stack (init_thread_union.stack)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

void default_idle(void);

Expand Down
1 change: 0 additions & 1 deletion arch/frv/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

/* data cache prefetch */
#define ARCH_HAS_PREFETCH
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#define HARD_RESET_NOW() ({ \
local_irq_disable(); \
Expand Down
1 change: 0 additions & 1 deletion arch/hexagon/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ struct thread_struct {
}

#define cpu_relax() __vmyield()
#define cpu_relax_yield() cpu_relax()

/*
* Decides where the kernel will search for a free chunk of vm space during
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ ia64_eoi (void)
}

#define cpu_relax() ia64_hint(ia64_hint_pause)
#define cpu_relax_yield() cpu_relax()

static inline int
ia64_get_irr(unsigned int vector)
Expand Down
1 change: 0 additions & 1 deletion arch/m32r/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,5 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.sp)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#endif /* _ASM_M32R_PROCESSOR_H */
1 change: 0 additions & 1 deletion arch/m68k/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,5 @@ unsigned long get_wchan(struct task_struct *p);
#define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#endif
1 change: 0 additions & 1 deletion arch/metag/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ unsigned long get_wchan(struct task_struct *p);
#define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

extern void setup_priv(void);

Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
extern const struct seq_operations cpuinfo_op;

# define cpu_relax() barrier()
# define cpu_relax_yield() cpu_relax()

#define task_pt_regs(tsk) \
(((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
Expand Down
1 change: 0 additions & 1 deletion arch/mips/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

/*
* Return_address is a replacement for __builtin_return_address(count)
Expand Down
1 change: 0 additions & 1 deletion arch/mn10300/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ extern void print_cpu_info(struct mn10300_cpuinfo *);
extern void dodgy_tsc(void);

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

/*
* User space process size: 1.75GB (default).
Expand Down
1 change: 0 additions & 1 deletion arch/nios2/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#endif /* __ASSEMBLY__ */

Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
#define init_stack (init_thread_union.stack)

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#endif /* __ASSEMBLY__ */
#endif /* __ASM_OPENRISC_PROCESSOR_H */
1 change: 0 additions & 1 deletion arch/parisc/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

/*
* parisc_requires_coherency() is used to identify the combined VIPT/PIPT
Expand Down
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
#define cpu_relax() barrier()
#endif

#define cpu_relax_yield() cpu_relax()

/* Check that a certain kernel stack pointer is valid in task_struct p */
int validate_sp(unsigned long sp, struct task_struct *p,
unsigned long nbytes);
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ static inline unsigned short stap(void)
/*
* Give up the time slice of the virtual PU.
*/
#define cpu_relax_yield cpu_relax_yield
void cpu_relax_yield(void);

#define cpu_relax() barrier()
Expand Down
1 change: 0 additions & 1 deletion arch/score/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ extern unsigned long get_wchan(struct task_struct *p);
#define current_text_addr() ({ __label__ _l; _l: &&_l; })

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()
#define release_thread(thread) do {} while (0)

/*
Expand Down
1 change: 0 additions & 1 deletion arch/sh/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ extern struct sh_cpuinfo cpu_data[];

#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

void default_idle(void);
void stop_this_cpu(void *);
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/include/asm/processor_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ extern struct task_struct *last_task_used_math;
int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

extern void (*sparc_idle)(void);

Expand Down
1 change: 0 additions & 1 deletion arch/sparc/include/asm/processor_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ unsigned long get_wchan(struct task_struct *task);
"nop\n\t" \
".previous" \
::: "memory")
#define cpu_relax_yield() cpu_relax()

/* Prefetch support. This is tuned for UltraSPARC-III and later.
* UltraSPARC-I will treat these as nops, and UltraSPARC-II has
Expand Down
2 changes: 0 additions & 2 deletions arch/tile/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ static inline void cpu_relax(void)
barrier();
}

#define cpu_relax_yield() cpu_relax()

/* Info on this processor (see fs/proc/cpuinfo.c) */
struct seq_operations;
extern const struct seq_operations cpuinfo_op;
Expand Down
1 change: 0 additions & 1 deletion arch/unicore32/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ extern void release_thread(struct task_struct *);
unsigned long get_wchan(struct task_struct *p);

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

#define task_pt_regs(p) \
((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,6 @@ static __always_inline void cpu_relax(void)
rep_nop();
}

#define cpu_relax_yield() cpu_relax()

/* Stop speculative execution and prefetching of modified code. */
static inline void sync_core(void)
{
Expand Down
1 change: 0 additions & 1 deletion arch/x86/um/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ static inline void rep_nop(void)
}

#define cpu_relax() rep_nop()
#define cpu_relax_yield() cpu_relax()

#define task_pt_regs(t) (&(t)->thread.regs)

Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])

#define cpu_relax() barrier()
#define cpu_relax_yield() cpu_relax()

/* Special register access. */

Expand Down
4 changes: 4 additions & 0 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,10 @@ static inline void calc_load_enter_idle(void) { }
static inline void calc_load_exit_idle(void) { }
#endif /* CONFIG_NO_HZ_COMMON */

#ifndef cpu_relax_yield
#define cpu_relax_yield() cpu_relax()
#endif

/*
* Do not use outside of architecture code which knows its limitations.
*
Expand Down

0 comments on commit 6d0d287

Please sign in to comment.