Figure
shows the code for rcu_online_cpu(), which informs RCU that the
specified CPU is coming online.
When dynticks (CONFIG_NO_HZ) is enabled, line 6 obtains a reference to the specified CPU's rcu_dynticks structure, which is shared between the ``rcu'' and ``rcu_bh'' implementations of RCU. Line 7 sets the ->dynticks_nesting field to the value one, reflecting the fact that a newly onlined CPU is not in dynticks-idle mode (recall that the ->dynticks_nesting field tracks the number of reasons that the corresponding CPU needs to be tracked for RCU read-side critical sections, in this case because it can run process-level code). Line 8 forces the ->dynticks field to an odd value that is at least as large as the last value it had when previously online, again reflecting the fact that newly onlined CPUs are not in dynticks-idle mode, and line 9 forces the ->dynticks_nmi field to an even value that is at least as large as the last value it had when previously online, reflecting the fact that this CPU is not currently executing in an NMI handler.
Lines 11-13 are executed regardless of the value of the CONFIG_NO_HZ kernel parameter. Line 11 initializes the specified CPU's rcu_data structure for ``rcu'', and line 12 does so for ``rcu_bh''. Finally, line 13 registers the rcu_process_callbacks() to be invoked by subsequent raise_softirq() invocations on this CPU.
Paul E. McKenney 2011-12-16