D.3.1.5 Kernel Parameters
Keywords: perfbook_html

###
D.3.1.5 Kernel Parameters

The following kernel parameters affect this variant of RCU:

- NR_CPUS, the maximum number of CPUs in the system.
- CONFIG_RCU_FANOUT, the desired number of children for each node in the rcu_node hierarchy.
- CONFIG_RCU_FANOUT_EXACT, a boolean preventing rebalancing of the rcu_node hierarchy.
- CONFIG_HOTPLUG_CPU, permitting CPUs to come online and go offline.
- CONFIG_NO_HZ, indicating that dynticks-idle mode is supported.
- CONFIG_SMP, indicating that multiple CPUs may be present.
- CONFIG_RCU_CPU_STALL_DETECTOR, indicating that RCU should check for stalled CPUs when RCU grace periods extend too long.
- CONFIG_RCU_TRACE, indicating that RCU should provide tracing information in debugfs.

Figure: Determining Shape of RCU Hierarchy

The CONFIG_RCU_FANOUT and NR_CPUS parameters are used to determine the shape of the rcu_node hierarchy at compile time, as shown in Figure . Line 1 defines the maximum depth of the rcu_node hierarchy, currently three. Note that increasing the maximum permitted depth requires changes elsewhere, for example, adding another leg to the #if statement running from lines 6-26. Lines 2-4 compute the fanout, the square of the fanout, and the cube of the fanout, respectively.

Then these values are compared to NR_CPUS to determine the required depth of the rcu_node hierarchy, which is placed into NUM_RCU_LVLS, which is used to size a number of arrays in the rcu_state structure. There is always one node at the root level, and there are always NUM_CPUS number of rcu_data structures below the leaf level. If there is more than just the root level, the number of nodes at the leaf level is computed by dividing NR_CPUS by RCU_FANOUT, rounding up. The number of nodes at other levels is computed in a similar manner, but using (for example) RCU_FANOUT_SQ instead of RCU_FANOUT.

Line 28 then sums up all of the levels, resulting in the number of rcu_node structures plus the number of rcu_data structures. Finally, line 29 subtracts NR_CPUS (which is the number of rcu_data structures) from the sum, resulting in the number of rcu_node structures, which is retained in NUM_RCU_NODES. This value is then used to size the ->nodes array in the rcu_state structure.