diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/atomic.h | 36 | ||||
| -rw-r--r-- | include/linux/bitops.h | 20 | ||||
| -rw-r--r-- | include/linux/buffer_head.h | 2 | ||||
| -rw-r--r-- | include/linux/genhd.h | 2 | ||||
| -rw-r--r-- | include/linux/interrupt.h | 8 | ||||
| -rw-r--r-- | include/linux/netdevice.h | 2 | ||||
| -rw-r--r-- | include/linux/sched.h | 6 | ||||
| -rw-r--r-- | include/linux/sunrpc/sched.h | 8 | ||||
| -rw-r--r-- | include/linux/sunrpc/xprt.h | 8 | ||||
| -rw-r--r-- | include/linux/tracehook.h | 2 |
10 files changed, 74 insertions, 20 deletions
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/include/linux/buffer_head.h b/include/linux/buffer_head.h index c40302f909ce..7cbf837a279c 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
| @@ -278,7 +278,7 @@ static inline void get_bh(struct buffer_head *bh) | |||
| 278 | 278 | ||
| 279 | static inline void put_bh(struct buffer_head *bh) | 279 | static inline void put_bh(struct buffer_head *bh) |
| 280 | { | 280 | { |
| 281 | smp_mb__before_atomic_dec(); | 281 | smp_mb__before_atomic(); |
| 282 | atomic_dec(&bh->b_count); | 282 | atomic_dec(&bh->b_count); |
| 283 | } | 283 | } |
| 284 | 284 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9f3c275e053e..ec274e0f4ed2 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -649,7 +649,7 @@ static inline void hd_ref_init(struct hd_struct *part) | |||
| 649 | static inline void hd_struct_get(struct hd_struct *part) | 649 | static inline void hd_struct_get(struct hd_struct *part) |
| 650 | { | 650 | { |
| 651 | atomic_inc(&part->ref); | 651 | atomic_inc(&part->ref); |
| 652 | smp_mb__after_atomic_inc(); | 652 | smp_mb__after_atomic(); |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | static inline int hd_struct_try_get(struct hd_struct *part) | 655 | static inline int hd_struct_try_get(struct hd_struct *part) |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 051c85032f48..cb19f09d7e3e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -491,7 +491,7 @@ static inline int tasklet_trylock(struct tasklet_struct *t) | |||
| 491 | 491 | ||
| 492 | static inline void tasklet_unlock(struct tasklet_struct *t) | 492 | static inline void tasklet_unlock(struct tasklet_struct *t) |
| 493 | { | 493 | { |
| 494 | smp_mb__before_clear_bit(); | 494 | smp_mb__before_atomic(); |
| 495 | clear_bit(TASKLET_STATE_RUN, &(t)->state); | 495 | clear_bit(TASKLET_STATE_RUN, &(t)->state); |
| 496 | } | 496 | } |
| 497 | 497 | ||
| @@ -539,7 +539,7 @@ static inline void tasklet_hi_schedule_first(struct tasklet_struct *t) | |||
| 539 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) | 539 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) |
| 540 | { | 540 | { |
| 541 | atomic_inc(&t->count); | 541 | atomic_inc(&t->count); |
| 542 | smp_mb__after_atomic_inc(); | 542 | smp_mb__after_atomic(); |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | static inline void tasklet_disable(struct tasklet_struct *t) | 545 | static inline void tasklet_disable(struct tasklet_struct *t) |
| @@ -551,13 +551,13 @@ static inline void tasklet_disable(struct tasklet_struct *t) | |||
| 551 | 551 | ||
| 552 | static inline void tasklet_enable(struct tasklet_struct *t) | 552 | static inline void tasklet_enable(struct tasklet_struct *t) |
| 553 | { | 553 | { |
| 554 | smp_mb__before_atomic_dec(); | 554 | smp_mb__before_atomic(); |
| 555 | atomic_dec(&t->count); | 555 | atomic_dec(&t->count); |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | static inline void tasklet_hi_enable(struct tasklet_struct *t) | 558 | static inline void tasklet_hi_enable(struct tasklet_struct *t) |
| 559 | { | 559 | { |
| 560 | smp_mb__before_atomic_dec(); | 560 | smp_mb__before_atomic(); |
| 561 | atomic_dec(&t->count); | 561 | atomic_dec(&t->count); |
| 562 | } | 562 | } |
| 563 | 563 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7ed3a3aa6604..616415a4fee4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -493,7 +493,7 @@ static inline void napi_disable(struct napi_struct *n) | |||
| 493 | static inline void napi_enable(struct napi_struct *n) | 493 | static inline void napi_enable(struct napi_struct *n) |
| 494 | { | 494 | { |
| 495 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | 495 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); |
| 496 | smp_mb__before_clear_bit(); | 496 | smp_mb__before_atomic(); |
| 497 | clear_bit(NAPI_STATE_SCHED, &n->state); | 497 | clear_bit(NAPI_STATE_SCHED, &n->state); |
| 498 | } | 498 | } |
| 499 | 499 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index ce93768a3312..b4f6bf982921 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -2795,10 +2795,8 @@ static inline bool __must_check current_set_polling_and_test(void) | |||
| 2795 | /* | 2795 | /* |
| 2796 | * Polling state must be visible before we test NEED_RESCHED, | 2796 | * Polling state must be visible before we test NEED_RESCHED, |
| 2797 | * paired by resched_task() | 2797 | * paired by resched_task() |
| 2798 | * | ||
| 2799 | * XXX: assumes set/clear bit are identical barrier wise. | ||
| 2800 | */ | 2798 | */ |
| 2801 | smp_mb__after_clear_bit(); | 2799 | smp_mb__after_atomic(); |
| 2802 | 2800 | ||
| 2803 | return unlikely(tif_need_resched()); | 2801 | return unlikely(tif_need_resched()); |
| 2804 | } | 2802 | } |
| @@ -2816,7 +2814,7 @@ static inline bool __must_check current_clr_polling_and_test(void) | |||
| 2816 | * Polling state must be visible before we test NEED_RESCHED, | 2814 | * Polling state must be visible before we test NEED_RESCHED, |
| 2817 | * paired by resched_task() | 2815 | * paired by resched_task() |
| 2818 | */ | 2816 | */ |
| 2819 | smp_mb__after_clear_bit(); | 2817 | smp_mb__after_atomic(); |
| 2820 | 2818 | ||
| 2821 | return unlikely(tif_need_resched()); | 2819 | return unlikely(tif_need_resched()); |
| 2822 | } | 2820 | } |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 3a847de83fab..ad7dbe2cfecd 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -142,18 +142,18 @@ struct rpc_task_setup { | |||
| 142 | test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) | 142 | test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) |
| 143 | #define rpc_clear_running(t) \ | 143 | #define rpc_clear_running(t) \ |
| 144 | do { \ | 144 | do { \ |
| 145 | smp_mb__before_clear_bit(); \ | 145 | smp_mb__before_atomic(); \ |
| 146 | clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ | 146 | clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ |
| 147 | smp_mb__after_clear_bit(); \ | 147 | smp_mb__after_atomic(); \ |
| 148 | } while (0) | 148 | } while (0) |
| 149 | 149 | ||
| 150 | #define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) | 150 | #define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) |
| 151 | #define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) | 151 | #define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) |
| 152 | #define rpc_clear_queued(t) \ | 152 | #define rpc_clear_queued(t) \ |
| 153 | do { \ | 153 | do { \ |
| 154 | smp_mb__before_clear_bit(); \ | 154 | smp_mb__before_atomic(); \ |
| 155 | clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ | 155 | clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ |
| 156 | smp_mb__after_clear_bit(); \ | 156 | smp_mb__after_atomic(); \ |
| 157 | } while (0) | 157 | } while (0) |
| 158 | 158 | ||
| 159 | #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) | 159 | #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 3e5efb2b236e..3876f0f1dfd3 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -379,9 +379,9 @@ static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt) | |||
| 379 | 379 | ||
| 380 | static inline void xprt_clear_connecting(struct rpc_xprt *xprt) | 380 | static inline void xprt_clear_connecting(struct rpc_xprt *xprt) |
| 381 | { | 381 | { |
| 382 | smp_mb__before_clear_bit(); | 382 | smp_mb__before_atomic(); |
| 383 | clear_bit(XPRT_CONNECTING, &xprt->state); | 383 | clear_bit(XPRT_CONNECTING, &xprt->state); |
| 384 | smp_mb__after_clear_bit(); | 384 | smp_mb__after_atomic(); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | static inline int xprt_connecting(struct rpc_xprt *xprt) | 387 | static inline int xprt_connecting(struct rpc_xprt *xprt) |
| @@ -411,9 +411,9 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt) | |||
| 411 | 411 | ||
| 412 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) | 412 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) |
| 413 | { | 413 | { |
| 414 | smp_mb__before_clear_bit(); | 414 | smp_mb__before_atomic(); |
| 415 | clear_bit(XPRT_BINDING, &xprt->state); | 415 | clear_bit(XPRT_BINDING, &xprt->state); |
| 416 | smp_mb__after_clear_bit(); | 416 | smp_mb__after_atomic(); |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) | 419 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 1e98b5530425..6f8ab7da27c4 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -191,7 +191,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs) | |||
| 191 | * pairs with task_work_add()->set_notify_resume() after | 191 | * pairs with task_work_add()->set_notify_resume() after |
| 192 | * hlist_add_head(task->task_works); | 192 | * hlist_add_head(task->task_works); |
| 193 | */ | 193 | */ |
| 194 | smp_mb__after_clear_bit(); | 194 | smp_mb__after_atomic(); |
| 195 | if (unlikely(current->task_works)) | 195 | if (unlikely(current->task_works)) |
| 196 | task_work_run(); | 196 | task_work_run(); |
| 197 | } | 197 | } |
