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

neeraj.upadhyay@kernel.org posted 10 patches 1 month, 2 weeks ago
[PATCH v2 05/10] rcu/tasks: Consider idle tasks not running on CPU as non-holdouts
Posted by neeraj.upadhyay@kernel.org 1 month, 2 weeks ago
From: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>

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@kernel.org>
---
 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