OSDN Git Service

tracing/osnoise: Force quiescent states while tracing
[tomoyo/tomoyo-test1.git] / kernel / trace / trace_osnoise.c
index 2aa3efd..5e3c62a 100644 (file)
@@ -1387,6 +1387,26 @@ 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()
+                */
+               if (IS_ENABLED(CONFIG_PREEMPT_RCU)) {
+                       local_irq_disable();
+                       rcu_momentary_dyntick_idle();
+                       local_irq_enable();
+               }
+
+               /*
                 * For the non-preemptive kernel config: let threads runs, if
                 * they so wish.
                 */