Skip to content

Commit

Permalink
locking/mcs: Allow architecture specific asm files to be used for con…
Browse files Browse the repository at this point in the history
…tended case

This patch allows each architecture to add its specific assembly optimized
arch_mcs_spin_lock_contended and arch_mcs_spinlock_uncontended for
MCS lock and unlock functions.

Signed-off-by: Tim Chen <[email protected]>
Cc: Scott J Norton <[email protected]>
Cc: Raghavendra K T <[email protected]>
Cc: AswinChandramouleeswaran <[email protected]>
Cc: George Spelvin <[email protected]>
Cc: Rik vanRiel <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: MichelLespinasse <[email protected]>
Cc: Peter Hurley <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Alex Shi <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Tim Chen <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: "Figo.zhang" <[email protected]>
Cc: "Paul E.McKenney" <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Matthew R Wilcox <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/1390347382.3138.67.camel@schen9-DESK
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
pdxChen authored and Ingo Molnar committed Feb 9, 2014
1 parent b119fa6 commit ddf1d16
Show file tree
Hide file tree
Showing 31 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/alpha/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/arc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += param.h
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ generic-y += irq_regs.h
generic-y += kdebug.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += msgbuf.h
generic-y += param.h
generic-y += parport.h
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += mutex.h
Expand Down
1 change: 1 addition & 0 deletions arch/avr32/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ generic-y += hash.h
generic-y += irq_regs.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += param.h
generic-y += percpu.h
generic-y += preempt.h
Expand Down
1 change: 1 addition & 0 deletions arch/blackfin/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += mutex.h
Expand Down
1 change: 1 addition & 0 deletions arch/c6x/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ generic-y += irq_regs.h
generic-y += kdebug.h
generic-y += kmap_types.h
generic-y += local.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += mmu.h
generic-y += mmu_context.h
Expand Down
1 change: 1 addition & 0 deletions arch/cris/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ generic-y += exec.h
generic-y += hash.h
generic-y += kvm_para.h
generic-y += linkage.h
generic-y += mcs_spinlock.h
generic-y += module.h
generic-y += preempt.h
generic-y += trace_clock.h
Expand Down
1 change: 1 addition & 0 deletions arch/frv/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ generic-y += kdebug.h
generic-y += kmap_types.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += pci.h
Expand Down
1 change: 1 addition & 0 deletions arch/ia64/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
generic-y += vtime.h
1 change: 1 addition & 0 deletions arch/m32r/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += module.h
generic-y += preempt.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/m68k/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += mutex.h
generic-y += percpu.h
Expand Down
1 change: 1 addition & 0 deletions arch/metag/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += msgbuf.h
generic-y += mutex.h
generic-y += param.h
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ generic-y += barrier.h
generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += syscalls.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/mips/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ generic-y += current.h
generic-y += emergency-restart.h
generic-y += hash.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mutex.h
generic-y += parport.h
generic-y += percpu.h
Expand Down
1 change: 1 addition & 0 deletions arch/mn10300/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ generic-y += barrier.h
generic-y += clkdev.h
generic-y += exec.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ generic-y += kdebug.h
generic-y += kmap_types.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += module.h
generic-y += msgbuf.h
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ generic-y += kdebug.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mutex.h
generic-y += param.h
generic-y += percpu.h
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

generic-y += clkdev.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += rwsem.h
generic-y += trace_clock.h
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

generic-y += clkdev.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
1 change: 1 addition & 0 deletions arch/score/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ header-y +=
generic-y += barrier.h
generic-y += clkdev.h
generic-y += hash.h
generic-y += mcs_spinlock.h
generic-y += preempt.h
generic-y += trace_clock.h
generic-y += xor.h
1 change: 1 addition & 0 deletions arch/sh/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ generic-y += irq_regs.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += param.h
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ generic-y += irq_regs.h
generic-y += linkage.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += module.h
generic-y += mutex.h
generic-y += preempt.h
Expand Down
1 change: 1 addition & 0 deletions arch/tile/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ generic-y += ipcbuf.h
generic-y += irq_regs.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += msgbuf.h
generic-y += mutex.h
generic-y += param.h
Expand Down
1 change: 1 addition & 0 deletions arch/um/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ generic-y += hw_irq.h
generic-y += io.h
generic-y += irq_regs.h
generic-y += kdebug.h
generic-y += mcs_spinlock.h
generic-y += mutex.h
generic-y += param.h
generic-y += pci.h
Expand Down
1 change: 1 addition & 0 deletions arch/unicore32/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ generic-y += irq_regs.h
generic-y += kdebug.h
generic-y += kmap_types.h
generic-y += local.h
generic-y += mcs_spinlock.h
generic-y += mman.h
generic-y += module.h
generic-y += msgbuf.h
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ genhdr-y += unistd_64.h
genhdr-y += unistd_x32.h

generic-y += clkdev.h
generic-y += mcs_spinlock.h
1 change: 1 addition & 0 deletions arch/xtensa/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ generic-y += kvm_para.h
generic-y += linkage.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += percpu.h
generic-y += preempt.h
generic-y += resource.h
Expand Down
13 changes: 13 additions & 0 deletions include/asm-generic/mcs_spinlock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef __ASM_MCS_SPINLOCK_H
#define __ASM_MCS_SPINLOCK_H

/*
* Architectures can define their own:
*
* arch_mcs_spin_lock_contended(l)
* arch_mcs_spin_unlock_contended(l)
*
* See kernel/locking/mcs_spinlock.c.
*/

#endif /* __ASM_MCS_SPINLOCK_H */
2 changes: 2 additions & 0 deletions include/linux/mcs_spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#ifndef __LINUX_MCS_SPINLOCK_H
#define __LINUX_MCS_SPINLOCK_H

#include <asm/mcs_spinlock.h>

struct mcs_spinlock {
struct mcs_spinlock *next;
int locked; /* 1 if lock acquired */
Expand Down

0 comments on commit ddf1d16

Please sign in to comment.