Commit 523bddd5 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcu/nocb: Reduce contention at no-CBs invocation-done time



Currently, nocb_cb_wait() unconditionally acquires the leaf rcu_node
->lock to advance callbacks when done invoking the previous batch.
It does this while holding ->nocb_lock, which means that contention on
the leaf rcu_node ->lock visits itself on the ->nocb_lock.  This commit
therefore makes this lock acquisition conditional, forgoing callback
advancement when the leaf rcu_node ->lock is not immediately available.
(In this case, the no-CBs grace-period kthread will eventually do any
needed callback advancement.)

Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
parent 6608c3a0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1805,9 +1805,10 @@ static void nocb_cb_wait(struct rcu_data *rdp)
	local_bh_enable();
	lockdep_assert_irqs_enabled();
	rcu_nocb_lock_irqsave(rdp, flags);
	raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
	if (raw_spin_trylock_rcu_node(rnp)) { /* irqs already disabled. */
		needwake_gp = rcu_advance_cbs(rdp->mynode, rdp);
		raw_spin_unlock_rcu_node(rnp); /* irqs remain disabled. */
	}
	if (rcu_segcblist_ready_cbs(&rdp->cblist)) {
		rcu_nocb_unlock_irqrestore(rdp, flags);
		if (needwake_gp)