Commit ddf1d169c0a489d498c1799a7043904a43b0c159

Authored by Tim Chen
Committed by Ingo Molnar
1 parent b119fa61d4

locking/mcs: Allow architecture specific asm files to be used for contended 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 <tim.c.chen@linux.intel.com>
Cc: Scott J Norton <scott.norton@hp.com>
Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: AswinChandramouleeswaran <aswin@hp.com>
Cc: George Spelvin <linux@horizon.com>
Cc: Rik vanRiel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: MichelLespinasse <walken@google.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Alex Shi <alex.shi@linaro.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Figo.zhang" <figo1802@gmail.com>
Cc: "Paul E.McKenney" <paulmck@linux.vnet.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Waiman Long <waiman.long@hp.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew R Wilcox <matthew.r.wilcox@intel.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1390347382.3138.67.camel@schen9-DESK
Signed-off-by: Ingo Molnar <mingo@kernel.org>

Showing 31 changed files with 44 additions and 0 deletions Side-by-side Diff

arch/alpha/include/asm/Kbuild
... ... @@ -3,6 +3,7 @@
3 3 generic-y += clkdev.h
4 4 generic-y += exec.h
5 5 generic-y += hash.h
  6 +generic-y += mcs_spinlock.h
6 7 generic-y += preempt.h
7 8 generic-y += trace_clock.h
arch/arc/include/asm/Kbuild
... ... @@ -22,6 +22,7 @@
22 22 generic-y += kvm_para.h
23 23 generic-y += local.h
24 24 generic-y += local64.h
  25 +generic-y += mcs_spinlock.h
25 26 generic-y += mman.h
26 27 generic-y += msgbuf.h
27 28 generic-y += param.h
arch/arm/include/asm/Kbuild
... ... @@ -14,6 +14,7 @@
14 14 generic-y += kdebug.h
15 15 generic-y += local.h
16 16 generic-y += local64.h
  17 +generic-y += mcs_spinlock.h
17 18 generic-y += msgbuf.h
18 19 generic-y += param.h
19 20 generic-y += parport.h
arch/arm64/include/asm/Kbuild
... ... @@ -23,6 +23,7 @@
23 23 generic-y += kvm_para.h
24 24 generic-y += local.h
25 25 generic-y += local64.h
  26 +generic-y += mcs_spinlock.h
26 27 generic-y += mman.h
27 28 generic-y += msgbuf.h
28 29 generic-y += mutex.h
arch/avr32/include/asm/Kbuild
... ... @@ -11,6 +11,7 @@
11 11 generic-y += irq_regs.h
12 12 generic-y += local.h
13 13 generic-y += local64.h
  14 +generic-y += mcs_spinlock.h
14 15 generic-y += param.h
15 16 generic-y += percpu.h
16 17 generic-y += preempt.h
arch/blackfin/include/asm/Kbuild
... ... @@ -20,6 +20,7 @@
20 20 generic-y += kvm_para.h
21 21 generic-y += local.h
22 22 generic-y += local64.h
  23 +generic-y += mcs_spinlock.h
23 24 generic-y += mman.h
24 25 generic-y += msgbuf.h
25 26 generic-y += mutex.h
arch/c6x/include/asm/Kbuild
... ... @@ -25,6 +25,7 @@
25 25 generic-y += kdebug.h
26 26 generic-y += kmap_types.h
27 27 generic-y += local.h
  28 +generic-y += mcs_spinlock.h
28 29 generic-y += mman.h
29 30 generic-y += mmu.h
30 31 generic-y += mmu_context.h
arch/cris/include/asm/Kbuild
... ... @@ -9,6 +9,7 @@
9 9 generic-y += hash.h
10 10 generic-y += kvm_para.h
11 11 generic-y += linkage.h
  12 +generic-y += mcs_spinlock.h
12 13 generic-y += module.h
13 14 generic-y += preempt.h
14 15 generic-y += trace_clock.h
arch/frv/include/asm/Kbuild
... ... @@ -2,6 +2,7 @@
2 2 generic-y += clkdev.h
3 3 generic-y += exec.h
4 4 generic-y += hash.h
  5 +generic-y += mcs_spinlock.h
5 6 generic-y += preempt.h
6 7 generic-y += trace_clock.h
arch/hexagon/include/asm/Kbuild
... ... @@ -27,6 +27,7 @@
27 27 generic-y += kmap_types.h
28 28 generic-y += local.h
29 29 generic-y += local64.h
  30 +generic-y += mcs_spinlock.h
30 31 generic-y += mman.h
31 32 generic-y += msgbuf.h
32 33 generic-y += pci.h
arch/ia64/include/asm/Kbuild
... ... @@ -3,6 +3,7 @@
3 3 generic-y += exec.h
4 4 generic-y += hash.h
5 5 generic-y += kvm_para.h
  6 +generic-y += mcs_spinlock.h
6 7 generic-y += preempt.h
7 8 generic-y += trace_clock.h
8 9 generic-y += vtime.h
arch/m32r/include/asm/Kbuild
... ... @@ -2,6 +2,7 @@
2 2 generic-y += clkdev.h
3 3 generic-y += exec.h
4 4 generic-y += hash.h
  5 +generic-y += mcs_spinlock.h
5 6 generic-y += module.h
6 7 generic-y += preempt.h
7 8 generic-y += trace_clock.h
arch/m68k/include/asm/Kbuild
... ... @@ -16,6 +16,7 @@
16 16 generic-y += kvm_para.h
17 17 generic-y += local.h
18 18 generic-y += local64.h
  19 +generic-y += mcs_spinlock.h
19 20 generic-y += mman.h
20 21 generic-y += mutex.h
21 22 generic-y += percpu.h
arch/metag/include/asm/Kbuild
... ... @@ -24,6 +24,7 @@
24 24 generic-y += kvm_para.h
25 25 generic-y += local.h
26 26 generic-y += local64.h
  27 +generic-y += mcs_spinlock.h
27 28 generic-y += msgbuf.h
28 29 generic-y += mutex.h
29 30 generic-y += param.h
arch/microblaze/include/asm/Kbuild
... ... @@ -3,6 +3,7 @@
3 3 generic-y += clkdev.h
4 4 generic-y += exec.h
5 5 generic-y += hash.h
  6 +generic-y += mcs_spinlock.h
6 7 generic-y += preempt.h
7 8 generic-y += syscalls.h
8 9 generic-y += trace_clock.h
arch/mips/include/asm/Kbuild
... ... @@ -4,6 +4,7 @@
4 4 generic-y += emergency-restart.h
5 5 generic-y += hash.h
6 6 generic-y += local64.h
  7 +generic-y += mcs_spinlock.h
7 8 generic-y += mutex.h
8 9 generic-y += parport.h
9 10 generic-y += percpu.h
arch/mn10300/include/asm/Kbuild
... ... @@ -3,6 +3,7 @@
3 3 generic-y += clkdev.h
4 4 generic-y += exec.h
5 5 generic-y += hash.h
  6 +generic-y += mcs_spinlock.h
6 7 generic-y += preempt.h
7 8 generic-y += trace_clock.h
arch/openrisc/include/asm/Kbuild
... ... @@ -35,6 +35,7 @@
35 35 generic-y += kmap_types.h
36 36 generic-y += kvm_para.h
37 37 generic-y += local.h
  38 +generic-y += mcs_spinlock.h
38 39 generic-y += mman.h
39 40 generic-y += module.h
40 41 generic-y += msgbuf.h
arch/parisc/include/asm/Kbuild
... ... @@ -14,6 +14,7 @@
14 14 generic-y += kvm_para.h
15 15 generic-y += local.h
16 16 generic-y += local64.h
  17 +generic-y += mcs_spinlock.h
17 18 generic-y += mutex.h
18 19 generic-y += param.h
19 20 generic-y += percpu.h
arch/powerpc/include/asm/Kbuild
1 1  
2 2 generic-y += clkdev.h
3 3 generic-y += hash.h
  4 +generic-y += mcs_spinlock.h
4 5 generic-y += preempt.h
5 6 generic-y += rwsem.h
6 7 generic-y += trace_clock.h
arch/s390/include/asm/Kbuild
... ... @@ -2,6 +2,7 @@
2 2  
3 3 generic-y += clkdev.h
4 4 generic-y += hash.h
  5 +generic-y += mcs_spinlock.h
5 6 generic-y += preempt.h
6 7 generic-y += trace_clock.h
arch/score/include/asm/Kbuild
... ... @@ -5,6 +5,7 @@
5 5 generic-y += barrier.h
6 6 generic-y += clkdev.h
7 7 generic-y += hash.h
  8 +generic-y += mcs_spinlock.h
8 9 generic-y += preempt.h
9 10 generic-y += trace_clock.h
10 11 generic-y += xor.h
arch/sh/include/asm/Kbuild
... ... @@ -15,6 +15,7 @@
15 15 generic-y += kvm_para.h
16 16 generic-y += local.h
17 17 generic-y += local64.h
  18 +generic-y += mcs_spinlock.h
18 19 generic-y += mman.h
19 20 generic-y += msgbuf.h
20 21 generic-y += param.h
arch/sparc/include/asm/Kbuild
... ... @@ -11,6 +11,7 @@
11 11 generic-y += linkage.h
12 12 generic-y += local.h
13 13 generic-y += local64.h
  14 +generic-y += mcs_spinlock.h
14 15 generic-y += module.h
15 16 generic-y += mutex.h
16 17 generic-y += preempt.h
arch/tile/include/asm/Kbuild
... ... @@ -19,6 +19,7 @@
19 19 generic-y += irq_regs.h
20 20 generic-y += local.h
21 21 generic-y += local64.h
  22 +generic-y += mcs_spinlock.h
22 23 generic-y += msgbuf.h
23 24 generic-y += mutex.h
24 25 generic-y += param.h
arch/um/include/asm/Kbuild
... ... @@ -15,6 +15,7 @@
15 15 generic-y += io.h
16 16 generic-y += irq_regs.h
17 17 generic-y += kdebug.h
  18 +generic-y += mcs_spinlock.h
18 19 generic-y += mutex.h
19 20 generic-y += param.h
20 21 generic-y += pci.h
arch/unicore32/include/asm/Kbuild
... ... @@ -25,6 +25,7 @@
25 25 generic-y += kdebug.h
26 26 generic-y += kmap_types.h
27 27 generic-y += local.h
  28 +generic-y += mcs_spinlock.h
28 29 generic-y += mman.h
29 30 generic-y += module.h
30 31 generic-y += msgbuf.h
arch/x86/include/asm/Kbuild
... ... @@ -5,4 +5,5 @@
5 5 genhdr-y += unistd_x32.h
6 6  
7 7 generic-y += clkdev.h
  8 +generic-y += mcs_spinlock.h
arch/xtensa/include/asm/Kbuild
... ... @@ -18,6 +18,7 @@
18 18 generic-y += linkage.h
19 19 generic-y += local.h
20 20 generic-y += local64.h
  21 +generic-y += mcs_spinlock.h
21 22 generic-y += percpu.h
22 23 generic-y += preempt.h
23 24 generic-y += resource.h
include/asm-generic/mcs_spinlock.h
  1 +#ifndef __ASM_MCS_SPINLOCK_H
  2 +#define __ASM_MCS_SPINLOCK_H
  3 +
  4 +/*
  5 + * Architectures can define their own:
  6 + *
  7 + * arch_mcs_spin_lock_contended(l)
  8 + * arch_mcs_spin_unlock_contended(l)
  9 + *
  10 + * See kernel/locking/mcs_spinlock.c.
  11 + */
  12 +
  13 +#endif /* __ASM_MCS_SPINLOCK_H */
include/linux/mcs_spinlock.h
... ... @@ -12,6 +12,8 @@
12 12 #ifndef __LINUX_MCS_SPINLOCK_H
13 13 #define __LINUX_MCS_SPINLOCK_H
14 14  
  15 +#include <asm/mcs_spinlock.h>
  16 +
15 17 struct mcs_spinlock {
16 18 struct mcs_spinlock *next;
17 19 int locked; /* 1 if lock acquired */