]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Shrink RCU based on number of CPUs
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 6 Sep 2012 22:38:02 +0000 (15:38 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 20 Sep 2012 21:55:51 +0000 (14:55 -0700)
Currently, rcu_init_geometry() only reshapes RCU's combining trees
if the leaf fanout is changed at boot time.  This means that by
default, kernels compiled with (say) NR_CPUS=4096 will keep oversized
data structures, even when running on systems with (say) four CPUs.

This commit therefore checks to see if the maximum number of CPUs on
the actual running system (nr_cpu_ids) differs from NR_CPUS, and if so
reshapes the combining trees accordingly.

Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcutree.c

index 5068e5119494e3ace2bd6f9c070a2ed3fcfb6219..52b24c052474ca5ac579e8b45742ced9e35063a9 100644 (file)
@@ -2819,7 +2819,8 @@ static void __init rcu_init_geometry(void)
        int rcu_capacity[MAX_RCU_LVLS + 1];
 
        /* If the compile-time values are accurate, just leave. */
-       if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF)
+       if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF &&
+           nr_cpu_ids == NR_CPUS)
                return;
 
        /*