summaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2021-07-06 01:43:43 +0200
committerPaul E. McKenney <paulmck@kernel.org>2021-08-06 13:41:49 -0700
commit508958259bb3d9ca4ec37f0abdb211e9a6f3daa2 (patch)
treedf4200f1051475a2abf001e92143d2d288359cd3 /kernel/sched/core.c
parent8211e922de2854130e3633f52cd4fc2d7817ceb0 (diff)
downloadlinux-stable-508958259bb3d9ca4ec37f0abdb211e9a6f3daa2.tar.gz
linux-stable-508958259bb3d9ca4ec37f0abdb211e9a6f3daa2.tar.bz2
linux-stable-508958259bb3d9ca4ec37f0abdb211e9a6f3daa2.zip
rcu: Explain why rcu_all_qs() is a stub in preemptible TREE RCU
The cond_resched() function reports an RCU quiescent state only in non-preemptible TREE RCU implementation. This commit therefore adds a comment explaining why cond_resched() does nothing in preemptible kernels. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Cc: Neeraj Upadhyay <neeraju@codeaurora.org> Cc: Joel Fernandes <joel@joelfernandes.org> Cc: Uladzislau Rezki <urezki@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2d9ff40f4661..6a03c3fac55c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7781,6 +7781,17 @@ int __sched __cond_resched(void)
preempt_schedule_common();
return 1;
}
+ /*
+ * In preemptible kernels, ->rcu_read_lock_nesting tells the tick
+ * whether the current CPU is in an RCU read-side critical section,
+ * so the tick can report quiescent states even for CPUs looping
+ * in kernel context. In contrast, in non-preemptible kernels,
+ * RCU readers leave no in-memory hints, which means that CPU-bound
+ * processes executing in kernel context might never report an
+ * RCU quiescent state. Therefore, the following code causes
+ * cond_resched() to report a quiescent state, but only when RCU
+ * is in urgent need of one.
+ */
#ifndef CONFIG_PREEMPT_RCU
rcu_all_qs();
#endif