[tip:core/rcu] rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  b9ad4d6ed18e23b0ff6a824b925a1278625d5345
Gitweb:     https://git.kernel.org/tip/b9ad4d6ed18e23b0ff6a824b925a1278625d5345
Author:     Paul E. McKenney <paulmck@xxxxxxxxxxxxx>
AuthorDate: Wed, 27 Mar 2019 09:09:47 -0700
Committer:  Paul E. McKenney <paulmck@xxxxxxxxxxxxx>
CommitDate: Sat, 25 May 2019 14:50:50 -0700

rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()

Although sync_rcu_exp_select_node_cpus() treats the current CPU as being
in a quiescent state, it might well migrate to some other CPU before
reaching the smp_call_function_single(), which could then result in an
unnecessary simulated self-IPI.  This commit therefore instead simply
refuses to invoke smp_call_function_single() on the current CPU, which
causes the later rcu_report_exp_cpu_mult() to report this CPU's quiescent
state with less overhead.

This also reduces the rcu_exp_handler() function's state space by removing
the direct call that this smp_call_function_single() uses to emulate the
requested self-IPI.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxx>
[ paulmck: Use get_cpu() instead of preempt_disable() per Joel Fernandes. ]
---
 kernel/rcu/tree_exp.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index 9c990df880d1..5390618787b6 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -384,7 +384,12 @@ retry_ipi:
 			mask_ofl_test |= mask;
 			continue;
 		}
+		if (get_cpu() == cpu) {
+			put_cpu();
+			continue;
+		}
 		ret = smp_call_function_single(cpu, rcu_exp_handler, NULL, 0);
+		put_cpu();
 		if (!ret) {
 			mask_ofl_ipi &= ~mask;
 			continue;



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux