With per-CPU blocked lists, a task can be on either the rcu_node's
blkd_tasks list or on the per-CPU blocked list.

Therefore, extend exit_rcu() to check both lists. This ensures that if
a task exits while on any blocked list, the cleanup path will properly
handle it.

Signed-off-by: Joel Fernandes <[email protected]>
---
 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 6ed3815bb912..8622e79660ed 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -978,8 +978,15 @@ static void rcu_flavor_sched_clock_irq(int user)
 void exit_rcu(void)
 {
        struct task_struct *t = current;
+       bool on_list;
 
-       if (unlikely(!list_empty(&current->rcu_node_entry))) {
+       /* Check if task is on any blocked list (rnp or per-CPU). */
+       on_list = !list_empty(&current->rcu_node_entry);
+#ifdef CONFIG_RCU_PER_CPU_BLOCKED_LISTS
+       on_list = on_list || !list_empty(&current->rcu_rdp_entry);
+#endif
+
+       if (unlikely(on_list)) {
                rcu_preempt_depth_set(1);
                barrier();
                WARN_ON_ONCE(!t->rcu_read_unlock_special.b.blocked);
-- 
2.34.1


Reply via email to