From: Frederic Weisbecker <frede...@kernel.org>

This commit sets SEGCBLIST_SOFTIRQ_ONLY once toggling is otherwise fully
complete, allowing further RCU callback manipulation to be carried out
locklessly and locally.

Cc: Josh Triplett <j...@joshtriplett.org>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
Cc: Lai Jiangshan <jiangshan...@gmail.com>
Cc: Joel Fernandes <j...@joelfernandes.org>
Cc: Neeraj Upadhyay <neer...@codeaurora.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Inspired-by: Paul E. McKenney <paul...@kernel.org>
Tested-by: Boqun Feng <boqun.f...@gmail.com>
Signed-off-by: Frederic Weisbecker <frede...@kernel.org>
Signed-off-by: Paul E. McKenney <paul...@kernel.org>
---
 kernel/rcu/tree_plugin.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 35dc9b3..8641b72 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2352,7 +2352,14 @@ static int __rcu_nocb_rdp_deoffload(struct rcu_data *rdp)
         */
        rcu_nocb_lock_irqsave(rdp, flags);
        rcu_nocb_flush_bypass(rdp, NULL, jiffies);
-       rcu_nocb_unlock_irqrestore(rdp, flags);
+       rcu_segcblist_set_flags(cblist, SEGCBLIST_SOFTIRQ_ONLY);
+       /*
+        * With SEGCBLIST_SOFTIRQ_ONLY, we can't use
+        * rcu_nocb_unlock_irqrestore() anymore. Theoretically we
+        * could set SEGCBLIST_SOFTIRQ_ONLY with cb unlocked and IRQs
+        * disabled now, but let's be paranoid.
+        */
+       raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags);
 
        return ret;
 }
-- 
2.9.5

Reply via email to