* [PATCH] tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs()
@ 2017-04-11 22:54 Steven Rostedt
2017-04-11 22:56 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2017-04-11 22:54 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: LKML
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
The trace_event benchmark thread runs in kernel space in an infinite loop
while also calling cond_resched() in case anything else wants to schedule
in. Unfortunately, on a PREEMPT kernel, that makes it a nop, in which case,
this will never voluntarily schedule. That will cause synchronize_rcu_tasks()
to forever block on this thread, while it is running.
This is exactly what cond_resched_rcu_qs() is for. Use that instead.
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/trace_benchmark.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
index e49fbe9..16a8cf0 100644
--- a/kernel/trace/trace_benchmark.c
+++ b/kernel/trace/trace_benchmark.c
@@ -153,10 +153,18 @@ static int benchmark_event_kthread(void *arg)
trace_do_benchmark();
/*
- * We don't go to sleep, but let others
- * run as well.
+ * We don't go to sleep, but let others run as well.
+ * This is bascially a "yield()" to let any task that
+ * wants to run, schedule in, but if the CPU is idle,
+ * we'll keep burning cycles.
+ *
+ * Note the _rcu_qs() version of cond_resched() will
+ * notify synchronize_rcu_tasks() that this thread has
+ * passed a quiescent state for rcu_tasks. Otherwise
+ * this thread will never voluntarily schedule which would
+ * block synchronize_rcu_tasks() indefinitely.
*/
- cond_resched();
+ cond_resched_rcu_qs();
}
return 0;
--
2.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs()
2017-04-11 22:54 [PATCH] tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs() Steven Rostedt
@ 2017-04-11 22:56 ` Steven Rostedt
2017-04-11 23:47 ` Paul E. McKenney
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2017-04-11 22:56 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: LKML
On Tue, 11 Apr 2017 18:54:35 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> The trace_event benchmark thread runs in kernel space in an infinite loop
> while also calling cond_resched() in case anything else wants to schedule
> in. Unfortunately, on a PREEMPT kernel, that makes it a nop, in which case,
> this will never voluntarily schedule. That will cause synchronize_rcu_tasks()
> to forever block on this thread, while it is running.
>
> This is exactly what cond_resched_rcu_qs() is for. Use that instead.
>
> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
This actually should be:
Recommended-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
-- Steve
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs()
2017-04-11 22:56 ` Steven Rostedt
@ 2017-04-11 23:47 ` Paul E. McKenney
0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2017-04-11 23:47 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML
On Tue, Apr 11, 2017 at 06:56:01PM -0400, Steven Rostedt wrote:
> On Tue, 11 Apr 2017 18:54:35 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > The trace_event benchmark thread runs in kernel space in an infinite loop
> > while also calling cond_resched() in case anything else wants to schedule
> > in. Unfortunately, on a PREEMPT kernel, that makes it a nop, in which case,
> > this will never voluntarily schedule. That will cause synchronize_rcu_tasks()
> > to forever block on this thread, while it is running.
> >
> > This is exactly what cond_resched_rcu_qs() is for. Use that instead.
> >
> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
>
> This actually should be:
>
> Recommended-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
And:
Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> -- Steve
>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-11 23:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 22:54 [PATCH] tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs() Steven Rostedt
2017-04-11 22:56 ` Steven Rostedt
2017-04-11 23:47 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome