@@ -50,13 +50,13 @@ extern int rcutorture_runnable; /* for sysctl */
50
50
#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
51
51
52
52
#if defined(CONFIG_TREE_RCU ) || defined(CONFIG_TREE_PREEMPT_RCU )
53
- extern void rcutorture_record_test_transition (void );
54
- extern void rcutorture_record_progress (unsigned long vernum );
55
- extern void do_trace_rcu_torture_read (const char * rcutorturename ,
56
- struct rcu_head * rhp ,
57
- unsigned long secs ,
58
- unsigned long c_old ,
59
- unsigned long c );
53
+ void rcutorture_record_test_transition (void );
54
+ void rcutorture_record_progress (unsigned long vernum );
55
+ void do_trace_rcu_torture_read (const char * rcutorturename ,
56
+ struct rcu_head * rhp ,
57
+ unsigned long secs ,
58
+ unsigned long c_old ,
59
+ unsigned long c );
60
60
#else
61
61
static inline void rcutorture_record_test_transition (void )
62
62
{
@@ -65,11 +65,11 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65
65
{
66
66
}
67
67
#ifdef CONFIG_RCU_TRACE
68
- extern void do_trace_rcu_torture_read (const char * rcutorturename ,
69
- struct rcu_head * rhp ,
70
- unsigned long secs ,
71
- unsigned long c_old ,
72
- unsigned long c );
68
+ void do_trace_rcu_torture_read (const char * rcutorturename ,
69
+ struct rcu_head * rhp ,
70
+ unsigned long secs ,
71
+ unsigned long c_old ,
72
+ unsigned long c );
73
73
#else
74
74
#define do_trace_rcu_torture_read (rcutorturename , rhp , secs , c_old , c ) \
75
75
do { } while (0)
@@ -118,8 +118,8 @@ extern void do_trace_rcu_torture_read(const char *rcutorturename,
118
118
* if CPU A and CPU B are the same CPU (but again only if the system has
119
119
* more than one CPU).
120
120
*/
121
- extern void call_rcu (struct rcu_head * head ,
122
- void (* func )(struct rcu_head * head ));
121
+ void call_rcu (struct rcu_head * head ,
122
+ void (* func )(struct rcu_head * head ));
123
123
124
124
#else /* #ifdef CONFIG_PREEMPT_RCU */
125
125
@@ -149,8 +149,8 @@ extern void call_rcu(struct rcu_head *head,
149
149
* See the description of call_rcu() for more detailed information on
150
150
* memory ordering guarantees.
151
151
*/
152
- extern void call_rcu_bh (struct rcu_head * head ,
153
- void (* func )(struct rcu_head * head ));
152
+ void call_rcu_bh (struct rcu_head * head ,
153
+ void (* func )(struct rcu_head * head ));
154
154
155
155
/**
156
156
* call_rcu_sched() - Queue an RCU for invocation after sched grace period.
@@ -171,16 +171,16 @@ extern void call_rcu_bh(struct rcu_head *head,
171
171
* See the description of call_rcu() for more detailed information on
172
172
* memory ordering guarantees.
173
173
*/
174
- extern void call_rcu_sched (struct rcu_head * head ,
175
- void (* func )(struct rcu_head * rcu ));
174
+ void call_rcu_sched (struct rcu_head * head ,
175
+ void (* func )(struct rcu_head * rcu ));
176
176
177
- extern void synchronize_sched (void );
177
+ void synchronize_sched (void );
178
178
179
179
#ifdef CONFIG_PREEMPT_RCU
180
180
181
- extern void __rcu_read_lock (void );
182
- extern void __rcu_read_unlock (void );
183
- extern void rcu_read_unlock_special (struct task_struct * t );
181
+ void __rcu_read_lock (void );
182
+ void __rcu_read_unlock (void );
183
+ void rcu_read_unlock_special (struct task_struct * t );
184
184
void synchronize_rcu (void );
185
185
186
186
/*
@@ -216,19 +216,19 @@ static inline int rcu_preempt_depth(void)
216
216
#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
217
217
218
218
/* Internal to kernel */
219
- extern void rcu_init (void );
220
- extern void rcu_sched_qs (int cpu );
221
- extern void rcu_bh_qs (int cpu );
222
- extern void rcu_check_callbacks (int cpu , int user );
219
+ void rcu_init (void );
220
+ void rcu_sched_qs (int cpu );
221
+ void rcu_bh_qs (int cpu );
222
+ void rcu_check_callbacks (int cpu , int user );
223
223
struct notifier_block ;
224
- extern void rcu_idle_enter (void );
225
- extern void rcu_idle_exit (void );
226
- extern void rcu_irq_enter (void );
227
- extern void rcu_irq_exit (void );
224
+ void rcu_idle_enter (void );
225
+ void rcu_idle_exit (void );
226
+ void rcu_irq_enter (void );
227
+ void rcu_irq_exit (void );
228
228
229
229
#ifdef CONFIG_RCU_USER_QS
230
- extern void rcu_user_enter (void );
231
- extern void rcu_user_exit (void );
230
+ void rcu_user_enter (void );
231
+ void rcu_user_exit (void );
232
232
#else
233
233
static inline void rcu_user_enter (void ) { }
234
234
static inline void rcu_user_exit (void ) { }
@@ -262,7 +262,7 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
262
262
} while (0)
263
263
264
264
#if defined(CONFIG_DEBUG_LOCK_ALLOC ) || defined(CONFIG_RCU_TRACE ) || defined(CONFIG_SMP )
265
- extern bool __rcu_is_watching (void );
265
+ bool __rcu_is_watching (void );
266
266
#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267
267
268
268
/*
@@ -289,8 +289,8 @@ void wait_rcu_gp(call_rcu_func_t crf);
289
289
* initialization.
290
290
*/
291
291
#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
292
- extern void init_rcu_head_on_stack (struct rcu_head * head );
293
- extern void destroy_rcu_head_on_stack (struct rcu_head * head );
292
+ void init_rcu_head_on_stack (struct rcu_head * head );
293
+ void destroy_rcu_head_on_stack (struct rcu_head * head );
294
294
#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
295
295
static inline void init_rcu_head_on_stack (struct rcu_head * head )
296
296
{
@@ -325,6 +325,7 @@ static inline void rcu_lock_release(struct lockdep_map *map)
325
325
extern struct lockdep_map rcu_lock_map ;
326
326
extern struct lockdep_map rcu_bh_lock_map ;
327
327
extern struct lockdep_map rcu_sched_lock_map ;
328
+ extern struct lockdep_map rcu_callback_map ;
328
329
extern int debug_lockdep_rcu_enabled (void );
329
330
330
331
/**
@@ -362,7 +363,7 @@ static inline int rcu_read_lock_held(void)
362
363
* rcu_read_lock_bh_held() is defined out of line to avoid #include-file
363
364
* hell.
364
365
*/
365
- extern int rcu_read_lock_bh_held (void );
366
+ int rcu_read_lock_bh_held (void );
366
367
367
368
/**
368
369
* rcu_read_lock_sched_held() - might we be in RCU-sched read-side critical section?
@@ -448,7 +449,7 @@ static inline int rcu_read_lock_sched_held(void)
448
449
449
450
#ifdef CONFIG_PROVE_RCU
450
451
451
- extern int rcu_my_thread_group_empty (void );
452
+ int rcu_my_thread_group_empty (void );
452
453
453
454
/**
454
455
* rcu_lockdep_assert - emit lockdep splat if specified condition not met
@@ -548,10 +549,48 @@ static inline void rcu_preempt_sleep_check(void)
548
549
smp_read_barrier_depends(); \
549
550
(_________p1); \
550
551
})
551
- #define __rcu_assign_pointer (p , v , space ) \
552
+
553
+ /**
554
+ * RCU_INITIALIZER() - statically initialize an RCU-protected global variable
555
+ * @v: The value to statically initialize with.
556
+ */
557
+ #define RCU_INITIALIZER (v ) (typeof(*(v)) __force __rcu *)(v)
558
+
559
+ /**
560
+ * rcu_assign_pointer() - assign to RCU-protected pointer
561
+ * @p: pointer to assign to
562
+ * @v: value to assign (publish)
563
+ *
564
+ * Assigns the specified value to the specified RCU-protected
565
+ * pointer, ensuring that any concurrent RCU readers will see
566
+ * any prior initialization.
567
+ *
568
+ * Inserts memory barriers on architectures that require them
569
+ * (which is most of them), and also prevents the compiler from
570
+ * reordering the code that initializes the structure after the pointer
571
+ * assignment. More importantly, this call documents which pointers
572
+ * will be dereferenced by RCU read-side code.
573
+ *
574
+ * In some special cases, you may use RCU_INIT_POINTER() instead
575
+ * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
576
+ * to the fact that it does not constrain either the CPU or the compiler.
577
+ * That said, using RCU_INIT_POINTER() when you should have used
578
+ * rcu_assign_pointer() is a very bad thing that results in
579
+ * impossible-to-diagnose memory corruption. So please be careful.
580
+ * See the RCU_INIT_POINTER() comment header for details.
581
+ *
582
+ * Note that rcu_assign_pointer() evaluates each of its arguments only
583
+ * once, appearances notwithstanding. One of the "extra" evaluations
584
+ * is in typeof() and the other visible only to sparse (__CHECKER__),
585
+ * neither of which actually execute the argument. As with most cpp
586
+ * macros, this execute-arguments-only-once property is important, so
587
+ * please be careful when making changes to rcu_assign_pointer() and the
588
+ * other macros that it invokes.
589
+ */
590
+ #define rcu_assign_pointer (p , v ) \
552
591
do { \
553
592
smp_wmb(); \
554
- (p) = (typeof(*v) __force space *) (v); \
593
+ ACCESS_ONCE (p) = RCU_INITIALIZER (v); \
555
594
} while (0)
556
595
557
596
@@ -889,32 +928,6 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
889
928
preempt_enable_notrace ();
890
929
}
891
930
892
- /**
893
- * rcu_assign_pointer() - assign to RCU-protected pointer
894
- * @p: pointer to assign to
895
- * @v: value to assign (publish)
896
- *
897
- * Assigns the specified value to the specified RCU-protected
898
- * pointer, ensuring that any concurrent RCU readers will see
899
- * any prior initialization.
900
- *
901
- * Inserts memory barriers on architectures that require them
902
- * (which is most of them), and also prevents the compiler from
903
- * reordering the code that initializes the structure after the pointer
904
- * assignment. More importantly, this call documents which pointers
905
- * will be dereferenced by RCU read-side code.
906
- *
907
- * In some special cases, you may use RCU_INIT_POINTER() instead
908
- * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
909
- * to the fact that it does not constrain either the CPU or the compiler.
910
- * That said, using RCU_INIT_POINTER() when you should have used
911
- * rcu_assign_pointer() is a very bad thing that results in
912
- * impossible-to-diagnose memory corruption. So please be careful.
913
- * See the RCU_INIT_POINTER() comment header for details.
914
- */
915
- #define rcu_assign_pointer (p , v ) \
916
- __rcu_assign_pointer((p), (v), __rcu)
917
-
918
931
/**
919
932
* RCU_INIT_POINTER() - initialize an RCU protected pointer
920
933
*
@@ -949,7 +962,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
949
962
*/
950
963
#define RCU_INIT_POINTER (p , v ) \
951
964
do { \
952
- p = (typeof(*v) __force __rcu *) (v); \
965
+ p = RCU_INITIALIZER (v); \
953
966
} while (0)
954
967
955
968
/**
@@ -958,7 +971,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
958
971
* GCC-style initialization for an RCU-protected pointer in a structure field.
959
972
*/
960
973
#define RCU_POINTER_INITIALIZER (p , v ) \
961
- .p = (typeof(*v) __force __rcu *) (v)
974
+ .p = RCU_INITIALIZER (v)
962
975
963
976
/*
964
977
* Does the specified offset indicate that the corresponding rcu_head
@@ -1005,16 +1018,16 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
1005
1018
__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
1006
1019
1007
1020
#ifdef CONFIG_RCU_NOCB_CPU
1008
- extern bool rcu_is_nocb_cpu (int cpu );
1021
+ bool rcu_is_nocb_cpu (int cpu );
1009
1022
#else
1010
1023
static inline bool rcu_is_nocb_cpu (int cpu ) { return false; }
1011
1024
#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
1012
1025
1013
1026
1014
1027
/* Only for use by adaptive-ticks code. */
1015
1028
#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016
- extern bool rcu_sys_is_idle (void );
1017
- extern void rcu_sysidle_force_exit (void );
1029
+ bool rcu_sys_is_idle (void );
1030
+ void rcu_sysidle_force_exit (void );
1018
1031
#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019
1032
1020
1033
static inline bool rcu_sys_is_idle (void )
0 commit comments