aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-06-27 12:36:29 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-07-17 17:58:59 -0400
commit704dd435ac7eaefa89fcd82fd2876b8330e00ff3 (patch)
tree7b57a6ab5bed14ddbd1a58ed015c853d3a8b7a6c
parent4f525a528b9e75571c6bedc6202beff1ced24c32 (diff)
rcu: Consolidate last open-coded expedited memory barrier
One of the requirements on RCU grace periods is that if there is a causal chain of operations that starts after one grace period and ends before another grace period, then the two grace periods must be serialized. There has been (and might still be) code that relies on this, for example, certain types of reference-counting code that does a call_rcu() within an RCU callback function. This requirement is why there is an smp_mb() at the end of both synchronize_sched_expedited() and synchronize_rcu_expedited(). However, this is the only smp_mb() in these functions, so it would be nicer to consolidate it into rcu_exp_gp_seq_end(). This commit does just that. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--kernel/rcu/tree.c2
-rw-r--r--kernel/rcu/tree_plugin.h1
2 files changed, 1 insertions, 2 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 44245ae4c1c2..a905d3ba8673 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3299,6 +3299,7 @@ static void rcu_exp_gp_seq_start(struct rcu_state *rsp)
3299static void rcu_exp_gp_seq_end(struct rcu_state *rsp) 3299static void rcu_exp_gp_seq_end(struct rcu_state *rsp)
3300{ 3300{
3301 rcu_seq_end(&rsp->expedited_sequence); 3301 rcu_seq_end(&rsp->expedited_sequence);
3302 smp_mb(); /* Ensure that consecutive grace periods serialize. */
3302} 3303}
3303static unsigned long rcu_exp_gp_seq_snap(struct rcu_state *rsp) 3304static unsigned long rcu_exp_gp_seq_snap(struct rcu_state *rsp)
3304{ 3305{
@@ -3431,7 +3432,6 @@ void synchronize_sched_expedited(void)
3431 3432
3432 rcu_exp_gp_seq_end(rsp); 3433 rcu_exp_gp_seq_end(rsp);
3433 mutex_unlock(&rnp->exp_funnel_mutex); 3434 mutex_unlock(&rnp->exp_funnel_mutex);
3434 smp_mb(); /* ensure subsequent action seen after grace period. */
3435 3435
3436 put_online_cpus(); 3436 put_online_cpus();
3437} 3437}
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index f0d71449ec0c..27b714601c6e 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -735,7 +735,6 @@ void synchronize_rcu_expedited(void)
735 /* Clean up and exit. */ 735 /* Clean up and exit. */
736 rcu_exp_gp_seq_end(rsp); 736 rcu_exp_gp_seq_end(rsp);
737 mutex_unlock(&rnp_unlock->exp_funnel_mutex); 737 mutex_unlock(&rnp_unlock->exp_funnel_mutex);
738 smp_mb(); /* ensure subsequent action seen after grace period. */
739} 738}
740EXPORT_SYMBOL_GPL(synchronize_rcu_expedited); 739EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
741 740