aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-07-03 17:15:31 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-08-30 19:02:47 -0400
commit358be2d3685cb0cca49c914e89824467ee0b589c (patch)
tree8550a9ff71b678eb75705ad5b74236f62fee1343 /kernel
parent709fdce7545c978e69f52eb19082ea3af44332f5 (diff)
rcu: Remove RCU_STATE_INITIALIZER()
Now that a given build of the Linux kernel has only one set of rcu_state, rcu_node, and rcu_data structures, there is no point in creating a macro to declare and compile-time initialize them. This commit therefore just does normal declaration and compile-time initialization of these structures. While in the area, this commit also removes #ifndefs of the no-longer-ever-defined preprocessor macro RCU_TREE_NONCORE. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcu/tree.c54
-rw-r--r--kernel/rcu/tree.h29
2 files changed, 37 insertions, 46 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 5f79315f094e..1d36cbcce1b4 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -72,46 +72,20 @@
72 72
73/* Data structures. */ 73/* Data structures. */
74 74
75/* 75static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, rcu_data);
76 * In order to export the rcu_state name to the tracing tools, it 76struct rcu_state rcu_state = {
77 * needs to be added in the __tracepoint_string section. 77 .level = { &rcu_state.node[0] },
78 * This requires defining a separate variable tp_<sname>_varname 78 .rda = &rcu_data,
79 * that points to the string being used, and this will allow 79 .call = call_rcu,
80 * the tracing userspace tools to be able to decipher the string 80 .gp_state = RCU_GP_IDLE,
81 * address to the matching string. 81 .gp_seq = (0UL - 300UL) << RCU_SEQ_CTR_SHIFT,
82 */ 82 .barrier_mutex = __MUTEX_INITIALIZER(rcu_state.barrier_mutex),
83#ifdef CONFIG_TRACING 83 .name = RCU_NAME,
84# define DEFINE_RCU_TPS(sname) \ 84 .abbr = RCU_ABBR,
85static char sname##_varname[] = #sname; \ 85 .exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex),
86static const char *tp_##sname##_varname __used __tracepoint_string = sname##_varname; 86 .exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex),
87# define RCU_STATE_NAME(sname) sname##_varname 87 .ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock),
88#else 88};
89# define DEFINE_RCU_TPS(sname)
90# define RCU_STATE_NAME(sname) __stringify(sname)
91#endif
92
93#define RCU_STATE_INITIALIZER(sname, sabbr, cr) \
94DEFINE_RCU_TPS(sname) \
95static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, rcu_data); \
96struct rcu_state rcu_state = { \
97 .level = { &rcu_state.node[0] }, \
98 .rda = &rcu_data, \
99 .call = cr, \
100 .gp_state = RCU_GP_IDLE, \
101 .gp_seq = (0UL - 300UL) << RCU_SEQ_CTR_SHIFT, \
102 .barrier_mutex = __MUTEX_INITIALIZER(rcu_state.barrier_mutex), \
103 .name = RCU_STATE_NAME(sname), \
104 .abbr = sabbr, \
105 .exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex), \
106 .exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex), \
107 .ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock), \
108}
109
110#ifdef CONFIG_PREEMPT_RCU
111RCU_STATE_INITIALIZER(rcu_preempt, 'p', call_rcu);
112#else
113RCU_STATE_INITIALIZER(rcu_sched, 's', call_rcu);
114#endif
115 89
116static struct rcu_state *const rcu_state_p = &rcu_state; 90static struct rcu_state *const rcu_state_p = &rcu_state;
117static struct rcu_data __percpu *const rcu_data_p = &rcu_data; 91static struct rcu_data __percpu *const rcu_data_p = &rcu_data;
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 38658ca87dcb..3f36562d3118 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -386,7 +386,6 @@ struct rcu_state {
386#define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */ 386#define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */
387#define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */ 387#define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */
388 388
389#ifndef RCU_TREE_NONCORE
390static const char * const gp_state_names[] = { 389static const char * const gp_state_names[] = {
391 "RCU_GP_IDLE", 390 "RCU_GP_IDLE",
392 "RCU_GP_WAIT_GPS", 391 "RCU_GP_WAIT_GPS",
@@ -398,7 +397,29 @@ static const char * const gp_state_names[] = {
398 "RCU_GP_CLEANUP", 397 "RCU_GP_CLEANUP",
399 "RCU_GP_CLEANED", 398 "RCU_GP_CLEANED",
400}; 399};
401#endif /* #ifndef RCU_TREE_NONCORE */ 400
401/*
402 * In order to export the rcu_state name to the tracing tools, it
403 * needs to be added in the __tracepoint_string section.
404 * This requires defining a separate variable tp_<sname>_varname
405 * that points to the string being used, and this will allow
406 * the tracing userspace tools to be able to decipher the string
407 * address to the matching string.
408 */
409#ifdef CONFIG_PREEMPT_RCU
410#define RCU_ABBR 'p'
411#define RCU_NAME_RAW "rcu_preempt"
412#else /* #ifdef CONFIG_PREEMPT_RCU */
413#define RCU_ABBR 's'
414#define RCU_NAME_RAW "rcu_sched"
415#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
416#ifndef CONFIG_TRACING
417#define RCU_NAME RCU_NAME_RAW
418#else /* #ifdef CONFIG_TRACING */
419static char rcu_name[] = RCU_NAME_RAW;
420static const char *tp_rcu_varname __used __tracepoint_string = rcu_name;
421#define RCU_NAME rcu_name
422#endif /* #else #ifdef CONFIG_TRACING */
402 423
403extern struct list_head rcu_struct_flavors; 424extern struct list_head rcu_struct_flavors;
404 425
@@ -426,8 +447,6 @@ DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);
426DECLARE_PER_CPU(char, rcu_cpu_has_work); 447DECLARE_PER_CPU(char, rcu_cpu_has_work);
427#endif /* #ifdef CONFIG_RCU_BOOST */ 448#endif /* #ifdef CONFIG_RCU_BOOST */
428 449
429#ifndef RCU_TREE_NONCORE
430
431/* Forward declarations for rcutree_plugin.h */ 450/* Forward declarations for rcutree_plugin.h */
432static void rcu_bootup_announce(void); 451static void rcu_bootup_announce(void);
433static void rcu_qs(void); 452static void rcu_qs(void);
@@ -495,5 +514,3 @@ void srcu_offline_cpu(unsigned int cpu);
495void srcu_online_cpu(unsigned int cpu) { } 514void srcu_online_cpu(unsigned int cpu) { }
496void srcu_offline_cpu(unsigned int cpu) { } 515void srcu_offline_cpu(unsigned int cpu) { }
497#endif /* #else #ifdef CONFIG_SRCU */ 516#endif /* #else #ifdef CONFIG_SRCU */
498
499#endif /* #ifndef RCU_TREE_NONCORE */