diff mbox series

[RFC,49/86] osnoise: handle quiescent states directly

Message ID 20231107215742.363031-50-ankur.a.arora@oracle.com (mailing list archive)
State New
Headers show
Series Make the kernel preemptible | expand

Commit Message

Ankur Arora Nov. 7, 2023, 9:57 p.m. UTC
To reduce RCU noise for the stopped tick case we introduce explicit
quiescent states for PREEMPT_RCU=y, and depend on cond_resched()
(and thus rcu_all_qs()) to handle PREEMPT_RCU=n.

With cond_resched() going away, introduce explicit quiescent states
for all configurations.

Suggested-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
---
 kernel/trace/trace_osnoise.c | 37 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index bd0d01d00fb9..db38934c4242 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1531,34 +1531,21 @@  static int run_osnoise(void)
 
 		/*
 		 * In some cases, notably when running on a nohz_full CPU with
-		 * a stopped tick PREEMPT_RCU has no way to account for QSs.
-		 * This will eventually cause unwarranted noise as PREEMPT_RCU
-		 * will force preemption as the means of ending the current
-		 * grace period. We avoid this problem by calling
-		 * rcu_momentary_dyntick_idle(), which performs a zero duration
-		 * EQS allowing PREEMPT_RCU to end the current grace period.
-		 * This call shouldn't be wrapped inside an RCU critical
-		 * section.
-		 *
-		 * Note that in non PREEMPT_RCU kernels QSs are handled through
-		 * cond_resched()
+		 * a stopped tick RCU has no way to account for QSs. This will
+		 * eventually cause unwarranted noise as RCU forces preemption
+		 * as the means of ending the current grace period.
+		 * We avoid this problem by calling rcu_momentary_dyntick_idle(),
+		 * which performs a zero duration EQS allowing RCU to end the
+		 * current grace period. This call shouldn't be wrapped inside
+		 * an RCU critical section.
 		 */
-		if (IS_ENABLED(CONFIG_PREEMPT_RCU)) {
-			if (!disable_irq)
-				local_irq_disable();
+		if (!disable_irq)
+			local_irq_disable();
 
-			rcu_momentary_dyntick_idle();
+		rcu_momentary_dyntick_idle();
 
-			if (!disable_irq)
-				local_irq_enable();
-		}
-
-		/*
-		 * For the non-preemptive kernel config: let threads runs, if
-		 * they so wish, unless set not do to so.
-		 */
-		if (!disable_irq && !disable_preemption)
-			cond_resched();
+		if (!disable_irq)
+			local_irq_enable();
 
 		last_sample = sample;
 		last_int_count = int_count;