diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/init_task.h | 4 | ||||
-rw-r--r-- | include/linux/key.h | 4 | ||||
-rw-r--r-- | include/linux/rcupdate.h | 50 |
3 files changed, 24 insertions, 34 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9e65eff6af3b..8a7476186990 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -168,8 +168,8 @@ extern struct cred init_cred; | |||
168 | .children = LIST_HEAD_INIT(tsk.children), \ | 168 | .children = LIST_HEAD_INIT(tsk.children), \ |
169 | .sibling = LIST_HEAD_INIT(tsk.sibling), \ | 169 | .sibling = LIST_HEAD_INIT(tsk.sibling), \ |
170 | .group_leader = &tsk, \ | 170 | .group_leader = &tsk, \ |
171 | RCU_INIT_POINTER(.real_cred, &init_cred), \ | 171 | RCU_POINTER_INITIALIZER(real_cred, &init_cred), \ |
172 | RCU_INIT_POINTER(.cred, &init_cred), \ | 172 | RCU_POINTER_INITIALIZER(cred, &init_cred), \ |
173 | .comm = INIT_TASK_COMM, \ | 173 | .comm = INIT_TASK_COMM, \ |
174 | .thread = INIT_THREAD, \ | 174 | .thread = INIT_THREAD, \ |
175 | .fs = &init_fs, \ | 175 | .fs = &init_fs, \ |
diff --git a/include/linux/key.h b/include/linux/key.h index 4cd22ed627ef..cef3b315ba7c 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -303,7 +303,9 @@ static inline bool key_is_instantiated(const struct key *key) | |||
303 | rwsem_is_locked(&((struct key *)(KEY))->sem))) | 303 | rwsem_is_locked(&((struct key *)(KEY))->sem))) |
304 | 304 | ||
305 | #define rcu_assign_keypointer(KEY, PAYLOAD) \ | 305 | #define rcu_assign_keypointer(KEY, PAYLOAD) \ |
306 | (rcu_assign_pointer((KEY)->payload.rcudata, PAYLOAD)) | 306 | do { \ |
307 | rcu_assign_pointer((KEY)->payload.rcudata, (PAYLOAD)); \ | ||
308 | } while (0) | ||
307 | 309 | ||
308 | #ifdef CONFIG_SYSCTL | 310 | #ifdef CONFIG_SYSCTL |
309 | extern ctl_table key_sysctls[]; | 311 | extern ctl_table key_sysctls[]; |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 9cac722b169c..c2c0d86dd3ac 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -147,6 +147,7 @@ extern void synchronize_sched(void); | |||
147 | 147 | ||
148 | extern void __rcu_read_lock(void); | 148 | extern void __rcu_read_lock(void); |
149 | extern void __rcu_read_unlock(void); | 149 | extern void __rcu_read_unlock(void); |
150 | extern void rcu_read_unlock_special(struct task_struct *t); | ||
150 | void synchronize_rcu(void); | 151 | void synchronize_rcu(void); |
151 | 152 | ||
152 | /* | 153 | /* |
@@ -255,6 +256,10 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head) | |||
255 | } | 256 | } |
256 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | 257 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ |
257 | 258 | ||
259 | #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP) | ||
260 | extern int rcu_is_cpu_idle(void); | ||
261 | #endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP) */ | ||
262 | |||
258 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) | 263 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) |
259 | bool rcu_lockdep_current_cpu_online(void); | 264 | bool rcu_lockdep_current_cpu_online(void); |
260 | #else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ | 265 | #else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ |
@@ -266,15 +271,6 @@ static inline bool rcu_lockdep_current_cpu_online(void) | |||
266 | 271 | ||
267 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 272 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
268 | 273 | ||
269 | #ifdef CONFIG_PROVE_RCU | ||
270 | extern int rcu_is_cpu_idle(void); | ||
271 | #else /* !CONFIG_PROVE_RCU */ | ||
272 | static inline int rcu_is_cpu_idle(void) | ||
273 | { | ||
274 | return 0; | ||
275 | } | ||
276 | #endif /* else !CONFIG_PROVE_RCU */ | ||
277 | |||
278 | static inline void rcu_lock_acquire(struct lockdep_map *map) | 274 | static inline void rcu_lock_acquire(struct lockdep_map *map) |
279 | { | 275 | { |
280 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); | 276 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); |
@@ -513,10 +509,10 @@ static inline void rcu_preempt_sleep_check(void) | |||
513 | (_________p1); \ | 509 | (_________p1); \ |
514 | }) | 510 | }) |
515 | #define __rcu_assign_pointer(p, v, space) \ | 511 | #define __rcu_assign_pointer(p, v, space) \ |
516 | ({ \ | 512 | do { \ |
517 | smp_wmb(); \ | 513 | smp_wmb(); \ |
518 | (p) = (typeof(*v) __force space *)(v); \ | 514 | (p) = (typeof(*v) __force space *)(v); \ |
519 | }) | 515 | } while (0) |
520 | 516 | ||
521 | 517 | ||
522 | /** | 518 | /** |
@@ -851,7 +847,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
851 | * | 847 | * |
852 | * Assigns the specified value to the specified RCU-protected | 848 | * Assigns the specified value to the specified RCU-protected |
853 | * pointer, ensuring that any concurrent RCU readers will see | 849 | * pointer, ensuring that any concurrent RCU readers will see |
854 | * any prior initialization. Returns the value assigned. | 850 | * any prior initialization. |
855 | * | 851 | * |
856 | * Inserts memory barriers on architectures that require them | 852 | * Inserts memory barriers on architectures that require them |
857 | * (which is most of them), and also prevents the compiler from | 853 | * (which is most of them), and also prevents the compiler from |
@@ -903,25 +899,17 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
903 | * the reader-accessible portions of the linked structure. | 899 | * the reader-accessible portions of the linked structure. |
904 | */ | 900 | */ |
905 | #define RCU_INIT_POINTER(p, v) \ | 901 | #define RCU_INIT_POINTER(p, v) \ |
906 | p = (typeof(*v) __force __rcu *)(v) | 902 | do { \ |
907 | 903 | p = (typeof(*v) __force __rcu *)(v); \ | |
908 | static __always_inline bool __is_kfree_rcu_offset(unsigned long offset) | 904 | } while (0) |
909 | { | ||
910 | return offset < 4096; | ||
911 | } | ||
912 | |||
913 | static __always_inline | ||
914 | void __kfree_rcu(struct rcu_head *head, unsigned long offset) | ||
915 | { | ||
916 | typedef void (*rcu_callback)(struct rcu_head *); | ||
917 | |||
918 | BUILD_BUG_ON(!__builtin_constant_p(offset)); | ||
919 | |||
920 | /* See the kfree_rcu() header comment. */ | ||
921 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); | ||
922 | 905 | ||
923 | kfree_call_rcu(head, (rcu_callback)offset); | 906 | /** |
924 | } | 907 | * RCU_POINTER_INITIALIZER() - statically initialize an RCU protected pointer |
908 | * | ||
909 | * GCC-style initialization for an RCU-protected pointer in a structure field. | ||
910 | */ | ||
911 | #define RCU_POINTER_INITIALIZER(p, v) \ | ||
912 | .p = (typeof(*v) __force __rcu *)(v) | ||
925 | 913 | ||
926 | /* | 914 | /* |
927 | * Does the specified offset indicate that the corresponding rcu_head | 915 | * Does the specified offset indicate that the corresponding rcu_head |
@@ -935,7 +923,7 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset) | |||
935 | #define __kfree_rcu(head, offset) \ | 923 | #define __kfree_rcu(head, offset) \ |
936 | do { \ | 924 | do { \ |
937 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \ | 925 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \ |
938 | call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \ | 926 | kfree_call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \ |
939 | } while (0) | 927 | } while (0) |
940 | 928 | ||
941 | /** | 929 | /** |