diff options
-rw-r--r-- | include/asm-generic/atomic.h | 7 | ||||
-rw-r--r-- | include/asm-generic/barrier.h | 8 | ||||
-rw-r--r-- | include/asm-generic/bitops.h | 9 | ||||
-rw-r--r-- | include/linux/atomic.h | 36 | ||||
-rw-r--r-- | include/linux/bitops.h | 20 | ||||
-rw-r--r-- | kernel/sched/core.c | 16 |
6 files changed, 82 insertions, 14 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 33bd2de3bc1e..9c79e7603459 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define __ASM_GENERIC_ATOMIC_H | 16 | #define __ASM_GENERIC_ATOMIC_H |
17 | 17 | ||
18 | #include <asm/cmpxchg.h> | 18 | #include <asm/cmpxchg.h> |
19 | #include <asm/barrier.h> | ||
19 | 20 | ||
20 | #ifdef CONFIG_SMP | 21 | #ifdef CONFIG_SMP |
21 | /* Force people to define core atomics */ | 22 | /* Force people to define core atomics */ |
@@ -182,11 +183,5 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | |||
182 | } | 183 | } |
183 | #endif | 184 | #endif |
184 | 185 | ||
185 | /* Assume that atomic operations are already serializing */ | ||
186 | #define smp_mb__before_atomic_dec() barrier() | ||
187 | #define smp_mb__after_atomic_dec() barrier() | ||
188 | #define smp_mb__before_atomic_inc() barrier() | ||
189 | #define smp_mb__after_atomic_inc() barrier() | ||
190 | |||
191 | #endif /* __KERNEL__ */ | 186 | #endif /* __KERNEL__ */ |
192 | #endif /* __ASM_GENERIC_ATOMIC_H */ | 187 | #endif /* __ASM_GENERIC_ATOMIC_H */ |
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h index 6f692f8ac664..1402fa855388 100644 --- a/include/asm-generic/barrier.h +++ b/include/asm-generic/barrier.h | |||
@@ -62,6 +62,14 @@ | |||
62 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) | 62 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #ifndef smp_mb__before_atomic | ||
66 | #define smp_mb__before_atomic() smp_mb() | ||
67 | #endif | ||
68 | |||
69 | #ifndef smp_mb__after_atomic | ||
70 | #define smp_mb__after_atomic() smp_mb() | ||
71 | #endif | ||
72 | |||
65 | #define smp_store_release(p, v) \ | 73 | #define smp_store_release(p, v) \ |
66 | do { \ | 74 | do { \ |
67 | compiletime_assert_atomic_type(*p); \ | 75 | compiletime_assert_atomic_type(*p); \ |
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 280ca7a96f75..dcdcacf2fd2b 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h | |||
@@ -11,14 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/irqflags.h> | 12 | #include <linux/irqflags.h> |
13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
14 | 14 | #include <asm/barrier.h> | |
15 | /* | ||
16 | * clear_bit may not imply a memory barrier | ||
17 | */ | ||
18 | #ifndef smp_mb__before_clear_bit | ||
19 | #define smp_mb__before_clear_bit() smp_mb() | ||
20 | #define smp_mb__after_clear_bit() smp_mb() | ||
21 | #endif | ||
22 | 15 | ||
23 | #include <asm-generic/bitops/__ffs.h> | 16 | #include <asm-generic/bitops/__ffs.h> |
24 | #include <asm-generic/bitops/ffz.h> | 17 | #include <asm-generic/bitops/ffz.h> |
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 5b08a8540ecf..fef3a809e7cf 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -3,6 +3,42 @@ | |||
3 | #define _LINUX_ATOMIC_H | 3 | #define _LINUX_ATOMIC_H |
4 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
5 | 5 | ||
6 | /* | ||
7 | * Provide __deprecated wrappers for the new interface, avoid flag day changes. | ||
8 | * We need the ugly external functions to break header recursion hell. | ||
9 | */ | ||
10 | #ifndef smp_mb__before_atomic_inc | ||
11 | static inline void __deprecated smp_mb__before_atomic_inc(void) | ||
12 | { | ||
13 | extern void __smp_mb__before_atomic(void); | ||
14 | __smp_mb__before_atomic(); | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | #ifndef smp_mb__after_atomic_inc | ||
19 | static inline void __deprecated smp_mb__after_atomic_inc(void) | ||
20 | { | ||
21 | extern void __smp_mb__after_atomic(void); | ||
22 | __smp_mb__after_atomic(); | ||
23 | } | ||
24 | #endif | ||
25 | |||
26 | #ifndef smp_mb__before_atomic_dec | ||
27 | static inline void __deprecated smp_mb__before_atomic_dec(void) | ||
28 | { | ||
29 | extern void __smp_mb__before_atomic(void); | ||
30 | __smp_mb__before_atomic(); | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #ifndef smp_mb__after_atomic_dec | ||
35 | static inline void __deprecated smp_mb__after_atomic_dec(void) | ||
36 | { | ||
37 | extern void __smp_mb__after_atomic(void); | ||
38 | __smp_mb__after_atomic(); | ||
39 | } | ||
40 | #endif | ||
41 | |||
6 | /** | 42 | /** |
7 | * atomic_add_unless - add unless the number is already a given value | 43 | * atomic_add_unless - add unless the number is already a given value |
8 | * @v: pointer of type atomic_t | 44 | * @v: pointer of type atomic_t |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index be5fd38bd5a0..cbc5833fb221 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -32,6 +32,26 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
32 | */ | 32 | */ |
33 | #include <asm/bitops.h> | 33 | #include <asm/bitops.h> |
34 | 34 | ||
35 | /* | ||
36 | * Provide __deprecated wrappers for the new interface, avoid flag day changes. | ||
37 | * We need the ugly external functions to break header recursion hell. | ||
38 | */ | ||
39 | #ifndef smp_mb__before_clear_bit | ||
40 | static inline void __deprecated smp_mb__before_clear_bit(void) | ||
41 | { | ||
42 | extern void __smp_mb__before_atomic(void); | ||
43 | __smp_mb__before_atomic(); | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | #ifndef smp_mb__after_clear_bit | ||
48 | static inline void __deprecated smp_mb__after_clear_bit(void) | ||
49 | { | ||
50 | extern void __smp_mb__after_atomic(void); | ||
51 | __smp_mb__after_atomic(); | ||
52 | } | ||
53 | #endif | ||
54 | |||
35 | #define for_each_set_bit(bit, addr, size) \ | 55 | #define for_each_set_bit(bit, addr, size) \ |
36 | for ((bit) = find_first_bit((addr), (size)); \ | 56 | for ((bit) = find_first_bit((addr), (size)); \ |
37 | (bit) < (size); \ | 57 | (bit) < (size); \ |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 268a45ea238c..8a70ec091760 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -90,6 +90,22 @@ | |||
90 | #define CREATE_TRACE_POINTS | 90 | #define CREATE_TRACE_POINTS |
91 | #include <trace/events/sched.h> | 91 | #include <trace/events/sched.h> |
92 | 92 | ||
93 | #ifdef smp_mb__before_atomic | ||
94 | void __smp_mb__before_atomic(void) | ||
95 | { | ||
96 | smp_mb__before_atomic(); | ||
97 | } | ||
98 | EXPORT_SYMBOL(__smp_mb__before_atomic); | ||
99 | #endif | ||
100 | |||
101 | #ifdef smp_mb__after_atomic | ||
102 | void __smp_mb__after_atomic(void) | ||
103 | { | ||
104 | smp_mb__after_atomic(); | ||
105 | } | ||
106 | EXPORT_SYMBOL(__smp_mb__after_atomic); | ||
107 | #endif | ||
108 | |||
93 | void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period) | 109 | void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period) |
94 | { | 110 | { |
95 | unsigned long delta; | 111 | unsigned long delta; |