[PATCH v2 05/10] rcu/tasks: Consider idle tasks not running on CPU as non-holdouts

From: neeraj . upadhyay
Date: Wed Oct 09 2024 - 08:57:19 EST


From: Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>

As idle tasks cannot be non-voluntary preempted, idle tasks which
are not running on CPU are not in RCU-tasks read side critical
section. So, remove them for holdout tasks for RCU-tasks.

Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>
---
kernel/rcu/tasks.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index b794deeaf6d8..9523aff6cdae 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -983,6 +983,15 @@ static bool rcu_idle_task_is_holdout(struct task_struct *t, int cpu)
if (!rcu_cpu_online(cpu))
return false;

+ /*
+ * As idle tasks cannot be involuntary preempted, non-running idle tasks
+ * are not in RCU-tasks critical section.
+ * synchronize_rcu() calls in rcu_tasks_pregp_step() and rcu_tasks_postgp()
+ * ensure that all ->on_cpu transitions are complete.
+ */
+ if (!t->on_cpu)
+ return false;
+
return true;
}
#else /* #ifdef CONFIG_SMP */
--
2.40.1