summaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-08-07 04:42:47 +0200
committerPaul E. McKenney <paulmck@kernel.org>2020-08-25 03:40:26 +0200
commit4e025f52a1e0e8ff4e303fa0a80e2061ccfa27d6 (patch)
tree4b9f198966d56c80579b1f52a8bb1d65cb107578 /kernel/rcu
parentrcu: IPI all CPUs at GP start for strict GPs (diff)
downloadlinux-4e025f52a1e0e8ff4e303fa0a80e2061ccfa27d6.tar.xz
linux-4e025f52a1e0e8ff4e303fa0a80e2061ccfa27d6.zip
rcu: IPI all CPUs at GP end for strict GPs
Currently, each CPU discovers the end of a given grace period on its own time, which is again good for efficiency but bad for fast grace periods, given that it is things like kfree() within the RCU callbacks that will cause trouble for pointers leaked from RCU read-side critical sections. This commit therefore uses on_each_cpu() to IPI each CPU after grace-period cleanup in order to inform each CPU of the end of the old grace period in a timely manner, but only in kernels build with CONFIG_RCU_STRICT_GRACE_PERIOD=y. Reported-by Jann Horn <jannh@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/tree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 88f4fa639964..4bbedfc0f79b 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2052,6 +2052,10 @@ static void rcu_gp_cleanup(void)
rcu_state.gp_flags & RCU_GP_FLAG_INIT);
}
raw_spin_unlock_irq_rcu_node(rnp);
+
+ // If strict, make all CPUs aware of the end of the old grace period.
+ if (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD))
+ on_each_cpu(rcu_strict_gp_boundary, NULL, 0);
}
/*