kernel-hacking-2024-linux-s.../Documentation/RCU
Paul E. McKenney 9b2e4f1880 rcu: Track idleness independent of idle tasks
Earlier versions of RCU used the scheduling-clock tick to detect idleness
by checking for the idle task, but handled idleness differently for
CONFIG_NO_HZ=y.  But there are now a number of uses of RCU read-side
critical sections in the idle task, for example, for tracing.  A more
fine-grained detection of idleness is therefore required.

This commit presses the old dyntick-idle code into full-time service,
so that rcu_idle_enter(), previously known as rcu_enter_nohz(), is
always invoked at the beginning of an idle loop iteration.  Similarly,
rcu_idle_exit(), previously known as rcu_exit_nohz(), is always invoked
at the end of an idle-loop iteration.  This allows the idle task to
use RCU everywhere except between consecutive rcu_idle_enter() and
rcu_idle_exit() calls, in turn allowing architecture maintainers to
specify exactly where in the idle loop that RCU may be used.

Because some of the userspace upcall uses can result in what looks
to RCU like half of an interrupt, it is not possible to expect that
the irq_enter() and irq_exit() hooks will give exact counts.  This
patch therefore expands the ->dynticks_nesting counter to 64 bits
and uses two separate bitfields to count process/idle transitions
and interrupt entry/exit transitions.  It is presumed that userspace
upcalls do not happen in the idle loop or from usermode execution
(though usermode might do a system call that results in an upcall).
The counter is hard-reset on each process/idle transition, which
avoids the interrupt entry/exit error from accumulating.  Overflow
is avoided by the 64-bitness of the ->dyntick_nesting counter.

This commit also adds warnings if a non-idle task asks RCU to enter
idle state (and these checks will need some adjustment before applying
Frederic's OS-jitter patches (http://lkml.org/lkml/2011/10/7/246).
In addition, validation of ->dynticks and ->dynticks_nesting is added.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2011-12-11 10:31:24 -08:00
..
00-INDEX rcu: Remove conditional compilation for RCU CPU stall warnings 2011-05-05 23:16:54 -07:00
arrayRCU.txt
checklist.txt rcu: document ways of stalling updates in low-memory situations 2010-08-20 09:00:14 -07:00
listRCU.txt
lockdep-splat.txt rcu: Document interpretation of RCU-lockdep splats 2011-09-28 21:38:28 -07:00
lockdep.txt rcu: Update documentation for additional RCU lockdep functions 2011-09-28 21:38:25 -07:00
NMI-RCU.txt rcu: Fix RCU's NMI documentation 2011-09-28 21:36:44 -07:00
rcu.txt rcu: 1Q2010 update for RCU documentation 2010-01-16 10:25:22 +01:00
rcubarrier.txt rcu: Add synchronize_sched_expedited() rcutorture doc + updates 2009-07-03 10:02:29 +02:00
rculist_nulls.txt netfilter: nf_conntrack: nf_conntrack_alloc() fixes 2009-07-16 14:03:40 +02:00
rcuref.txt
RTFP.txt Documentation: update broken web addresses. 2010-08-04 15:21:40 +02:00
stallwarn.txt rcu: Remove conditional compilation for RCU CPU stall warnings 2011-05-05 23:16:54 -07:00
torture.txt rcu: Catch rcutorture up to new RCU API additions 2011-09-28 21:36:43 -07:00
trace.txt rcu: Track idleness independent of idle tasks 2011-12-11 10:31:24 -08:00
UP.txt rcu: Add synchronize_sched_expedited() rcutorture doc + updates 2009-07-03 10:02:29 +02:00
whatisRCU.txt rcu: add documentation saying which RCU flavor to choose 2011-03-04 08:05:25 -08:00