rcu: Make rcu_start_future_gp()'s grace-period check more precise
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 11 Apr 2018 22:54:32 +0000 (15:54 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 15 May 2018 17:29:13 +0000 (10:29 -0700)
commit825a9911f6447299a69edacecc81fa2cdc5290a7
tree4e9194b4ffea485151dc97a1847ddb7e2b4af923
parent9036c2ffd596261d2067fc2d693dc4f0d7a51214
rcu: Make rcu_start_future_gp()'s grace-period check more precise

The rcu_start_future_gp() function uses a sloppy check for a grace
period being in progress, which works today because there are a number
of code sequences that resolve the resulting races.  However, some of
these race-resolution code sequences must acquire the root rcu_node
structure's ->lock, and contention on that lock has started manifesting.
This commit therefore makes rcu_start_future_gp() check more precise,
eliminating the sloppy lockless check of the rcu_state structure's ->gpnum
and ->completed fields.  The effect is that rcu_start_future_gp() will
sometimes unnecessarily attempt to start a new grace period, but this
overhead will be reduced later using funnel locking.

Reported-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Nicholas Piggin <npiggin@gmail.com>
kernel/rcu/tree.c