Commit 358be2d3 authored by Paul E. McKenney's avatar Paul E. McKenney

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 709fdce7
...@@ -72,46 +72,20 @@ ...@@ -72,46 +72,20 @@
/* Data structures. */ /* Data structures. */
/* static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, rcu_data);
* In order to export the rcu_state name to the tracing tools, it struct rcu_state rcu_state = {
* needs to be added in the __tracepoint_string section. .level = { &rcu_state.node[0] },
* This requires defining a separate variable tp_<sname>_varname .rda = &rcu_data,
* that points to the string being used, and this will allow .call = call_rcu,
* the tracing userspace tools to be able to decipher the string .gp_state = RCU_GP_IDLE,
* address to the matching string. .gp_seq = (0UL - 300UL) << RCU_SEQ_CTR_SHIFT,
*/ .barrier_mutex = __MUTEX_INITIALIZER(rcu_state.barrier_mutex),
#ifdef CONFIG_TRACING .name = RCU_NAME,
# define DEFINE_RCU_TPS(sname) \ .abbr = RCU_ABBR,
static char sname##_varname[] = #sname; \ .exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex),
static const char *tp_##sname##_varname __used __tracepoint_string = sname##_varname; .exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex),
# define RCU_STATE_NAME(sname) sname##_varname .ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock),
#else };
# define DEFINE_RCU_TPS(sname)
# define RCU_STATE_NAME(sname) __stringify(sname)
#endif
#define RCU_STATE_INITIALIZER(sname, sabbr, cr) \
DEFINE_RCU_TPS(sname) \
static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, rcu_data); \
struct rcu_state rcu_state = { \
.level = { &rcu_state.node[0] }, \
.rda = &rcu_data, \
.call = cr, \
.gp_state = RCU_GP_IDLE, \
.gp_seq = (0UL - 300UL) << RCU_SEQ_CTR_SHIFT, \
.barrier_mutex = __MUTEX_INITIALIZER(rcu_state.barrier_mutex), \
.name = RCU_STATE_NAME(sname), \
.abbr = sabbr, \
.exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex), \
.exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex), \
.ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock), \
}
#ifdef CONFIG_PREEMPT_RCU
RCU_STATE_INITIALIZER(rcu_preempt, 'p', call_rcu);
#else
RCU_STATE_INITIALIZER(rcu_sched, 's', call_rcu);
#endif
static struct rcu_state *const rcu_state_p = &rcu_state; static struct rcu_state *const rcu_state_p = &rcu_state;
static struct rcu_data __percpu *const rcu_data_p = &rcu_data; static struct rcu_data __percpu *const rcu_data_p = &rcu_data;
......
...@@ -386,7 +386,6 @@ struct rcu_state { ...@@ -386,7 +386,6 @@ struct rcu_state {
#define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */ #define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */
#define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */ #define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */
#ifndef RCU_TREE_NONCORE
static const char * const gp_state_names[] = { static const char * const gp_state_names[] = {
"RCU_GP_IDLE", "RCU_GP_IDLE",
"RCU_GP_WAIT_GPS", "RCU_GP_WAIT_GPS",
...@@ -398,7 +397,29 @@ static const char * const gp_state_names[] = { ...@@ -398,7 +397,29 @@ static const char * const gp_state_names[] = {
"RCU_GP_CLEANUP", "RCU_GP_CLEANUP",
"RCU_GP_CLEANED", "RCU_GP_CLEANED",
}; };
#endif /* #ifndef RCU_TREE_NONCORE */
/*
* In order to export the rcu_state name to the tracing tools, it
* needs to be added in the __tracepoint_string section.
* This requires defining a separate variable tp_<sname>_varname
* that points to the string being used, and this will allow
* the tracing userspace tools to be able to decipher the string
* address to the matching string.
*/
#ifdef CONFIG_PREEMPT_RCU
#define RCU_ABBR 'p'
#define RCU_NAME_RAW "rcu_preempt"
#else /* #ifdef CONFIG_PREEMPT_RCU */
#define RCU_ABBR 's'
#define RCU_NAME_RAW "rcu_sched"
#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
#ifndef CONFIG_TRACING
#define RCU_NAME RCU_NAME_RAW
#else /* #ifdef CONFIG_TRACING */
static char rcu_name[] = RCU_NAME_RAW;
static const char *tp_rcu_varname __used __tracepoint_string = rcu_name;
#define RCU_NAME rcu_name
#endif /* #else #ifdef CONFIG_TRACING */
extern struct list_head rcu_struct_flavors; extern struct list_head rcu_struct_flavors;
...@@ -426,8 +447,6 @@ DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_loops); ...@@ -426,8 +447,6 @@ DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);
DECLARE_PER_CPU(char, rcu_cpu_has_work); DECLARE_PER_CPU(char, rcu_cpu_has_work);
#endif /* #ifdef CONFIG_RCU_BOOST */ #endif /* #ifdef CONFIG_RCU_BOOST */
#ifndef RCU_TREE_NONCORE
/* Forward declarations for rcutree_plugin.h */ /* Forward declarations for rcutree_plugin.h */
static void rcu_bootup_announce(void); static void rcu_bootup_announce(void);
static void rcu_qs(void); static void rcu_qs(void);
...@@ -495,5 +514,3 @@ void srcu_offline_cpu(unsigned int cpu); ...@@ -495,5 +514,3 @@ void srcu_offline_cpu(unsigned int cpu);
void srcu_online_cpu(unsigned int cpu) { } void srcu_online_cpu(unsigned int cpu) { }
void srcu_offline_cpu(unsigned int cpu) { } void srcu_offline_cpu(unsigned int cpu) { }
#endif /* #else #ifdef CONFIG_SRCU */ #endif /* #else #ifdef CONFIG_SRCU */
#endif /* #ifndef RCU_TREE_NONCORE */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment