mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
rcu: Don't funnel-lock above leaf node if GP in progress
The old grace-period start code would acquire only the leaf's rcu_node structure's ->lock if that structure believed that a grace period was in progress. The new code advances to the leaf's parent in this case, needlessly acquiring then leaf's parent's ->lock. This commit therefore checks the grace-period state after marking the leaf with the need for the specified grace period, and if the leaf believes that a grace period is in progress, takes an early exit. Reported-by: Joel Fernandes <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> [ paulmck: Add "Startedleaf" tracing as suggested by Joel Fernandes. ]
This commit is contained in:
parent
e1333462e3
commit
a2165e4168
2 changed files with 11 additions and 2 deletions
|
|
@ -1590,6 +1590,15 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, struct rcu_data *rdp,
|
|||
goto unlock_out;
|
||||
}
|
||||
rnp_root->gp_seq_needed = c;
|
||||
if (rcu_seq_state(rcu_seq_current(&rnp->gp_seq))) {
|
||||
/*
|
||||
* We just marked the leaf, and a grace period
|
||||
* is in progress, which means that rcu_gp_cleanup()
|
||||
* will see the marking. Bail to reduce contention.
|
||||
*/
|
||||
trace_rcu_this_gp(rnp, rdp, c, TPS("Startedleaf"));
|
||||
goto unlock_out;
|
||||
}
|
||||
if (rnp_root != rnp && rnp_root->parent != NULL)
|
||||
raw_spin_unlock_rcu_node(rnp_root);
|
||||
if (!rnp_root->parent)
|
||||
|
|
|
|||
Loading…
Reference in a new issue