aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2016-07-28 12:39:11 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2016-08-22 12:35:57 -0400
commit3563a438f124cb0b8cfd350c86de2f26c63d8837 (patch)
tree43872e3e3f0bd66b37cf7b7887dcb86f915908c7 /kernel/rcu
parente77b7041258e11ba198951553d3acf1e371a9053 (diff)
rcu: Avoid redundant quiescent-state chasing
Currently, __note_gp_changes() checks to see if the CPU has slept through multiple grace periods. If it has, it resynchronizes that CPU's view of the grace-period state, which includes whether or not the current grace period needs a quiescent state from this CPU. The fact of this need (or lack thereof) needs to be in two places, rdp->cpu_no_qs.b.norm and rdp->core_needs_qs. The former tells RCU's context-switch code to go get a quiescent state and the latter says that it needs to be reported. The current code unconditionally sets the former to true, but correctly sets the latter. This does not result in failures, but it does unnecessarily increase the amount of work done on average at context-switch time. This commit therefore correctly sets both fields. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index e83446062f65..733902c33dd2 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1846,6 +1846,7 @@ static bool __note_gp_changes(struct rcu_state *rsp, struct rcu_node *rnp,
1846 struct rcu_data *rdp) 1846 struct rcu_data *rdp)
1847{ 1847{
1848 bool ret; 1848 bool ret;
1849 bool need_gp;
1849 1850
1850 /* Handle the ends of any preceding grace periods first. */ 1851 /* Handle the ends of any preceding grace periods first. */
1851 if (rdp->completed == rnp->completed && 1852 if (rdp->completed == rnp->completed &&
@@ -1872,9 +1873,10 @@ static bool __note_gp_changes(struct rcu_state *rsp, struct rcu_node *rnp,
1872 */ 1873 */
1873 rdp->gpnum = rnp->gpnum; 1874 rdp->gpnum = rnp->gpnum;
1874 trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("cpustart")); 1875 trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("cpustart"));
1875 rdp->cpu_no_qs.b.norm = true; 1876 need_gp = !!(rnp->qsmask & rdp->grpmask);
1877 rdp->cpu_no_qs.b.norm = need_gp;
1876 rdp->rcu_qs_ctr_snap = __this_cpu_read(rcu_qs_ctr); 1878 rdp->rcu_qs_ctr_snap = __this_cpu_read(rcu_qs_ctr);
1877 rdp->core_needs_qs = !!(rnp->qsmask & rdp->grpmask); 1879 rdp->core_needs_qs = need_gp;
1878 zero_cpu_stall_ticks(rdp); 1880 zero_cpu_stall_ticks(rdp);
1879 WRITE_ONCE(rdp->gpwrap, false); 1881 WRITE_ONCE(rdp->gpwrap, false);
1880 } 1882 }