Skip to content

Commit 9fd858c

Browse files
terminusfbq
authored andcommitted
osnoise: provide quiescent states
To reduce RCU noise for nohz_full configurations, osnoise depends on cond_resched() providing quiescent states for PREEMPT_RCU=n configurations. For PREEMPT_RCU=y configurations -- where cond_resched() is a stub -- we do this by directly calling rcu_momentary_eqs(). With (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), however, we have a configuration with (PREEMPTION=y, PREEMPT_RCU=n) where neither of the above can help. Handle that by providing an explicit quiescent state here for all configurations. As mentioned above this is not needed for non-stubbed cond_resched(), but, providing a quiescent state here just pulls in one that a future cond_resched() would provide, so doesn't cause any extra work for this configuration. Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Daniel Bristot de Oliveira <bristot@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Suggested-by: Paul E. McKenney <paulmck@kernel.org> Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent 83b28cf commit 9fd858c

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

kernel/trace/trace_osnoise.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,27 +1542,25 @@ static int run_osnoise(void)
15421542

15431543
/*
15441544
* In some cases, notably when running on a nohz_full CPU with
1545-
* a stopped tick PREEMPT_RCU has no way to account for QSs.
1546-
* This will eventually cause unwarranted noise as PREEMPT_RCU
1547-
* will force preemption as the means of ending the current
1548-
* grace period. We avoid this problem by calling
1549-
* rcu_momentary_eqs(), which performs a zero duration
1550-
* EQS allowing PREEMPT_RCU to end the current grace period.
1551-
* This call shouldn't be wrapped inside an RCU critical
1552-
* section.
1545+
* a stopped tick PREEMPT_RCU or PREEMPT_LAZY have no way to
1546+
* account for QSs. This will eventually cause unwarranted
1547+
* noise as RCU forces preemption as the means of ending the
1548+
* current grace period. We avoid this by calling
1549+
* rcu_momentary_eqs(), which performs a zero duration EQS
1550+
* allowing RCU to end the current grace period. This call
1551+
* shouldn't be wrapped inside an RCU critical section.
15531552
*
1554-
* Note that in non PREEMPT_RCU kernels QSs are handled through
1555-
* cond_resched()
1553+
* Normally QSs for other cases are handled through cond_resched().
1554+
* For simplicity, however, we call rcu_momentary_eqs() for all
1555+
* configurations here.
15561556
*/
1557-
if (IS_ENABLED(CONFIG_PREEMPT_RCU)) {
1558-
if (!disable_irq)
1559-
local_irq_disable();
1557+
if (!disable_irq)
1558+
local_irq_disable();
15601559

1561-
rcu_momentary_eqs();
1560+
rcu_momentary_eqs();
15621561

1563-
if (!disable_irq)
1564-
local_irq_enable();
1565-
}
1562+
if (!disable_irq)
1563+
local_irq_enable();
15661564

15671565
/*
15681566
* For the non-preemptive kernel config: let threads runs, if

0 commit comments

Comments
 (0)