sched,rcu: Make cond_resched() report RCU quiescent states
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 17 Mar 2014 04:36:25 +0000 (21:36 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 14 May 2014 16:46:11 +0000 (09:46 -0700)
commitac1bea85781e9004da9b3e8a4b097c18492d857c
treee28ea65bf56d1624371885954a46ab64cab1524b
parent0e980234c97f98be6619b9281d83777f725b94ff
sched,rcu: Make cond_resched() report RCU quiescent states

Given a CPU running a loop containing cond_resched(), with no
other tasks runnable on that CPU, RCU will eventually report RCU
CPU stall warnings due to lack of quiescent states.  Fortunately,
every call to cond_resched() is a perfectly good quiescent state.
Unfortunately, invoking rcu_note_context_switch() is a bit heavyweight
for cond_resched(), especially given the need to disable preemption,
and, for RCU-preempt, interrupts as well.

This commit therefore maintains a per-CPU counter that causes
cond_resched(), cond_resched_lock(), and cond_resched_softirq() to call
rcu_note_context_switch(), but only about once per 256 invocations.
This ratio was chosen in keeping with the relative time constants of
RCU grace periods.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
include/linux/rcupdate.h
kernel/rcu/update.c
kernel/sched/core.c
This page took 0.04206 seconds and 5 git commands to generate.