diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-04-15 15:08:22 -0400 | 
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-05-27 15:59:01 -0400 | 
| commit | eab128e8305f2bc4c91406031aab26d86fecced6 (patch) | |
| tree | 80aec9d6b5d0d3cc999e3a3bd02cf68e211cc6cf /kernel/rcu/tree.c | |
| parent | 7d0ae8086b828311250c6afdf800b568ac9bd693 (diff) | |
rcu: Modulate grace-period slow init to normalize delay
Currently, the larger the gp_init_delay boot parameter, the slower
rcutorture will sequence through grace periods.  This commit avoids this
issue by decreasing the probability of slowing initialization of a given
grace period as the degree of slowness increases.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
| -rw-r--r-- | kernel/rcu/tree.c | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 0628df155970..c34422d92aa9 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -169,7 +169,17 @@ module_param(gp_init_delay, int, 0644); | |||
| 169 | #else /* #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */ | 169 | #else /* #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */ | 
| 170 | static const int gp_init_delay; | 170 | static const int gp_init_delay; | 
| 171 | #endif /* #else #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */ | 171 | #endif /* #else #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */ | 
| 172 | #define PER_RCU_NODE_PERIOD 10 /* Number of grace periods between delays. */ | 172 | |
| 173 | /* | ||
| 174 | * Number of grace periods between delays, normalized by the duration of | ||
| 175 | * the delay. The longer the the delay, the more the grace periods between | ||
| 176 | * each delay. The reason for this normalization is that it means that, | ||
| 177 | * for non-zero delays, the overall slowdown of grace periods is constant | ||
| 178 | * regardless of the duration of the delay. This arrangement balances | ||
| 179 | * the need for long delays to increase some race probabilities with the | ||
| 180 | * need for fast grace periods to increase other race probabilities. | ||
| 181 | */ | ||
| 182 | #define PER_RCU_NODE_PERIOD 3 /* Number of grace periods between delays. */ | ||
| 173 | 183 | ||
| 174 | /* | 184 | /* | 
| 175 | * Track the rcutorture test sequence number and the update version | 185 | * Track the rcutorture test sequence number and the update version | 
| @@ -1848,7 +1858,8 @@ static int rcu_gp_init(struct rcu_state *rsp) | |||
| 1848 | cond_resched_rcu_qs(); | 1858 | cond_resched_rcu_qs(); | 
| 1849 | WRITE_ONCE(rsp->gp_activity, jiffies); | 1859 | WRITE_ONCE(rsp->gp_activity, jiffies); | 
| 1850 | if (gp_init_delay > 0 && | 1860 | if (gp_init_delay > 0 && | 
| 1851 | !(rsp->gpnum % (rcu_num_nodes * PER_RCU_NODE_PERIOD))) | 1861 | !(rsp->gpnum % | 
| 1862 | (rcu_num_nodes * PER_RCU_NODE_PERIOD * gp_init_delay))) | ||
| 1852 | schedule_timeout_uninterruptible(gp_init_delay); | 1863 | schedule_timeout_uninterruptible(gp_init_delay); | 
| 1853 | } | 1864 | } | 
| 1854 | 1865 | ||
