[lkml]   [2012]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH tip/core/rcu 02/15] rcu: Size rcu_node tree from nr_cpu_ids rather than NR_CPUS
    From: "Paul E. McKenney" <>

    The rcu_node tree array is sized based on compile-time constants,
    including NR_CPUS. Although this approach has worked well in the past,
    the recent trend by many distros to define NR_CPUS=4096 results in
    excessive grace-period-initialization latencies.

    This commit therefore substitutes the run-time computed nr_cpu_ids for
    the compile-time NR_CPUS when building the tree. This can result in
    much of the compile-time-allocated rcu_node array being unused. If
    this is a major problem, you are in a specialized situation anyway,
    so you can manually adjust the NR_CPUS, RCU_FANOUT, and RCU_FANOUT_LEAF
    kernel config parameters.

    Signed-off-by: Paul E. McKenney <>
    kernel/rcutree.c | 2 +-
    kernel/rcutree_plugin.h | 2 ++
    2 files changed, 3 insertions(+), 1 deletions(-)

    diff --git a/kernel/rcutree.c b/kernel/rcutree.c
    index a151184..9098910 100644
    --- a/kernel/rcutree.c
    +++ b/kernel/rcutree.c
    @@ -2672,7 +2672,7 @@ static void __init rcu_init_geometry(void)
    int i;
    int j;
    - int n = NR_CPUS;
    + int n = nr_cpu_ids;
    int rcu_capacity[MAX_RCU_LVLS + 1];

    /* If the compile-time values are accurate, just leave. */
    diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
    index e9b44c3..7cb86ae 100644
    --- a/kernel/rcutree_plugin.h
    +++ b/kernel/rcutree_plugin.h
    @@ -72,6 +72,8 @@ static void __init rcu_bootup_announce_oddness(void)
    if (rcu_fanout_leaf != CONFIG_RCU_FANOUT_LEAF)
    printk(KERN_INFO "\tExperimental boot-time adjustment of leaf fanout.\n");
    + if (nr_cpu_ids != NR_CPUS)
    + printk(KERN_INFO "\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids);


     \ /
      Last update: 2012-06-16 11:02    [W:0.030 / U:2.496 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site