diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-03-04 10:53:04 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-05-27 15:58:00 -0400 |
commit | 2927a689e8ad5c12d6300b41e873d2b7957bc0e1 (patch) | |
tree | 1356c096fce1bef08241085779ce5cf69a229f9e | |
parent | b28a7c016618e5e32e0703e3dd111dbba02715ff (diff) |
rcu: Create an immutable rcu_data_p pointer to default rcu_data structure
This commit creates an immutable rcu_data_p pointer that references
rcu_preempt_data for TREE_PREEMPT_RCU builds and that references
rcu_sched_data for TREE_RCU builds. This rcu_data_p pointer will enable
more code to move from #ifdef to IS_ENABLED().
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | kernel/rcu/tree.c | 1 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 16 |
2 files changed, 10 insertions, 7 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index f031700514dd..213f644d6fb1 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -111,6 +111,7 @@ RCU_STATE_INITIALIZER(rcu_sched, 's', call_rcu_sched); | |||
111 | RCU_STATE_INITIALIZER(rcu_bh, 'b', call_rcu_bh); | 111 | RCU_STATE_INITIALIZER(rcu_bh, 'b', call_rcu_bh); |
112 | 112 | ||
113 | static struct rcu_state *const rcu_state_p; | 113 | static struct rcu_state *const rcu_state_p; |
114 | static struct rcu_data __percpu *const rcu_data_p; | ||
114 | LIST_HEAD(rcu_struct_flavors); | 115 | LIST_HEAD(rcu_struct_flavors); |
115 | 116 | ||
116 | /* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */ | 117 | /* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */ |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 18b057adc21a..5c0122f09ed0 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -101,6 +101,7 @@ static void __init rcu_bootup_announce_oddness(void) | |||
101 | 101 | ||
102 | RCU_STATE_INITIALIZER(rcu_preempt, 'p', call_rcu); | 102 | RCU_STATE_INITIALIZER(rcu_preempt, 'p', call_rcu); |
103 | static struct rcu_state *const rcu_state_p = &rcu_preempt_state; | 103 | static struct rcu_state *const rcu_state_p = &rcu_preempt_state; |
104 | static struct rcu_data __percpu *const rcu_data_p = &rcu_preempt_data; | ||
104 | 105 | ||
105 | static int rcu_preempted_readers_exp(struct rcu_node *rnp); | 106 | static int rcu_preempted_readers_exp(struct rcu_node *rnp); |
106 | static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp, | 107 | static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp, |
@@ -126,11 +127,11 @@ static void __init rcu_bootup_announce(void) | |||
126 | */ | 127 | */ |
127 | static void rcu_preempt_qs(void) | 128 | static void rcu_preempt_qs(void) |
128 | { | 129 | { |
129 | if (!__this_cpu_read(rcu_preempt_data.passed_quiesce)) { | 130 | if (!__this_cpu_read(rcu_data_p->passed_quiesce)) { |
130 | trace_rcu_grace_period(TPS("rcu_preempt"), | 131 | trace_rcu_grace_period(TPS("rcu_preempt"), |
131 | __this_cpu_read(rcu_preempt_data.gpnum), | 132 | __this_cpu_read(rcu_data_p->gpnum), |
132 | TPS("cpuqs")); | 133 | TPS("cpuqs")); |
133 | __this_cpu_write(rcu_preempt_data.passed_quiesce, 1); | 134 | __this_cpu_write(rcu_data_p->passed_quiesce, 1); |
134 | barrier(); /* Coordinate with rcu_preempt_check_callbacks(). */ | 135 | barrier(); /* Coordinate with rcu_preempt_check_callbacks(). */ |
135 | current->rcu_read_unlock_special.b.need_qs = false; | 136 | current->rcu_read_unlock_special.b.need_qs = false; |
136 | } | 137 | } |
@@ -495,8 +496,8 @@ static void rcu_preempt_check_callbacks(void) | |||
495 | return; | 496 | return; |
496 | } | 497 | } |
497 | if (t->rcu_read_lock_nesting > 0 && | 498 | if (t->rcu_read_lock_nesting > 0 && |
498 | __this_cpu_read(rcu_preempt_data.qs_pending) && | 499 | __this_cpu_read(rcu_data_p->qs_pending) && |
499 | !__this_cpu_read(rcu_preempt_data.passed_quiesce)) | 500 | !__this_cpu_read(rcu_data_p->passed_quiesce)) |
500 | t->rcu_read_unlock_special.b.need_qs = true; | 501 | t->rcu_read_unlock_special.b.need_qs = true; |
501 | } | 502 | } |
502 | 503 | ||
@@ -504,7 +505,7 @@ static void rcu_preempt_check_callbacks(void) | |||
504 | 505 | ||
505 | static void rcu_preempt_do_callbacks(void) | 506 | static void rcu_preempt_do_callbacks(void) |
506 | { | 507 | { |
507 | rcu_do_batch(rcu_state_p, this_cpu_ptr(&rcu_preempt_data)); | 508 | rcu_do_batch(rcu_state_p, this_cpu_ptr(rcu_data_p)); |
508 | } | 509 | } |
509 | 510 | ||
510 | #endif /* #ifdef CONFIG_RCU_BOOST */ | 511 | #endif /* #ifdef CONFIG_RCU_BOOST */ |
@@ -811,7 +812,7 @@ EXPORT_SYMBOL_GPL(rcu_barrier); | |||
811 | */ | 812 | */ |
812 | static void __init __rcu_init_preempt(void) | 813 | static void __init __rcu_init_preempt(void) |
813 | { | 814 | { |
814 | rcu_init_one(rcu_state_p, &rcu_preempt_data); | 815 | rcu_init_one(rcu_state_p, rcu_data_p); |
815 | } | 816 | } |
816 | 817 | ||
817 | /* | 818 | /* |
@@ -835,6 +836,7 @@ void exit_rcu(void) | |||
835 | #else /* #ifdef CONFIG_PREEMPT_RCU */ | 836 | #else /* #ifdef CONFIG_PREEMPT_RCU */ |
836 | 837 | ||
837 | static struct rcu_state *const rcu_state_p = &rcu_sched_state; | 838 | static struct rcu_state *const rcu_state_p = &rcu_sched_state; |
839 | static struct rcu_data __percpu *const rcu_data_p = &rcu_sched_data; | ||
838 | 840 | ||
839 | /* | 841 | /* |
840 | * Tell them what RCU they are running. | 842 | * Tell them what RCU they are running. |