Skip to content

Commit 5bc455f

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
srcu: Rename srcu_might_be_idle() to srcu_should_expedite()
SRCU auto-expedites grace periods that follow a sufficiently long idle period, and the srcu_might_be_idle() function is used to make this decision. However, the upcoming light-weight SRCU readers will not do auto-expediting because doing so would cause the grace-period machinery to invoke synchronize_rcu_expedited() twice, with IPIs all around. However, software-engineering considerations force this determination to remain in srcu_might_be_idle(). This commit therefore changes the name of srcu_might_be_idle() to srcu_should_expedite(), thus moving from what it currently does to why it does it, this latter being more future-proof. Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 79a20a8 commit 5bc455f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

kernel/rcu/srcutree.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,8 @@ static void srcu_flip(struct srcu_struct *ssp)
11391139
}
11401140

11411141
/*
1142-
* If SRCU is likely idle, return true, otherwise return false.
1142+
* If SRCU is likely idle, in other words, the next SRCU grace period
1143+
* should be expedited, return true, otherwise return false.
11431144
*
11441145
* Note that it is OK for several current from-idle requests for a new
11451146
* grace period from idle to specify expediting because they will all end
@@ -1159,7 +1160,7 @@ static void srcu_flip(struct srcu_struct *ssp)
11591160
* negligible when amortized over that time period, and the extra latency
11601161
* of a needlessly non-expedited grace period is similarly negligible.
11611162
*/
1162-
static bool srcu_might_be_idle(struct srcu_struct *ssp)
1163+
static bool srcu_should_expedite(struct srcu_struct *ssp)
11631164
{
11641165
unsigned long curseq;
11651166
unsigned long flags;
@@ -1469,14 +1470,15 @@ EXPORT_SYMBOL_GPL(synchronize_srcu_expedited);
14691470
* Implementation of these memory-ordering guarantees is similar to
14701471
* that of synchronize_rcu().
14711472
*
1472-
* If SRCU is likely idle, expedite the first request. This semantic
1473-
* was provided by Classic SRCU, and is relied upon by its users, so TREE
1474-
* SRCU must also provide it. Note that detecting idleness is heuristic
1475-
* and subject to both false positives and negatives.
1473+
* If SRCU is likely idle as determined by srcu_should_expedite(),
1474+
* expedite the first request. This semantic was provided by Classic SRCU,
1475+
* and is relied upon by its users, so TREE SRCU must also provide it.
1476+
* Note that detecting idleness is heuristic and subject to both false
1477+
* positives and negatives.
14761478
*/
14771479
void synchronize_srcu(struct srcu_struct *ssp)
14781480
{
1479-
if (srcu_might_be_idle(ssp) || rcu_gp_is_expedited())
1481+
if (srcu_should_expedite(ssp) || rcu_gp_is_expedited())
14801482
synchronize_srcu_expedited(ssp);
14811483
else
14821484
__synchronize_srcu(ssp, true);

0 commit comments

Comments
 (0)