Skip to content

Commit b980b11

Browse files
committed
tracing: Have the trace_event benchmark thread call cond_resched_rcu_qs()
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. Acked-by: "Paul E. McKenney" <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent fcdc712 commit b980b11

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

kernel/trace/trace_benchmark.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,18 @@ static int benchmark_event_kthread(void *arg)
153153
trace_do_benchmark();
154154

155155
/*
156-
* We don't go to sleep, but let others
157-
* run as well.
156+
* We don't go to sleep, but let others run as well.
157+
* This is bascially a "yield()" to let any task that
158+
* wants to run, schedule in, but if the CPU is idle,
159+
* we'll keep burning cycles.
160+
*
161+
* Note the _rcu_qs() version of cond_resched() will
162+
* notify synchronize_rcu_tasks() that this thread has
163+
* passed a quiescent state for rcu_tasks. Otherwise
164+
* this thread will never voluntarily schedule which would
165+
* block synchronize_rcu_tasks() indefinitely.
158166
*/
159-
cond_resched();
167+
cond_resched_rcu_qs();
160168
}
161169

162170
return 0;

0 commit comments

Comments
 (0)