lkml.org 
[lkml]   [2015]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH tip/core/rcu 20/24] rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT
    Date
    From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

    This commit introduces an RCU_FANOUT C-preprocessor macro so that RCU will
    build even when CONFIG_RCU_FANOUT is undefined. The RCU_FANOUT macro is
    set to the value of CONFIG_RCU_FANOUT when defined, otherwise it is set
    to 32 for 32-bit systems and 64 for 64-bit systems. This commit then
    makes CONFIG_RCU_FANOUT depend on CONFIG_RCU_EXPERT, so that Kconfig
    users won't be asked about CONFIG_RCU_FANOUT unless they want to be.

    Reported-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
    ---
    init/Kconfig | 2 +-
    kernel/rcu/tree.c | 4 ++--
    kernel/rcu/tree.h | 17 ++++++++++++++---
    kernel/rcu/tree_plugin.h | 6 +++---
    4 files changed, 20 insertions(+), 9 deletions(-)

    diff --git a/init/Kconfig b/init/Kconfig
    index ac5386937d37..fd2d4fb517ca 100644
    --- a/init/Kconfig
    +++ b/init/Kconfig
    @@ -583,7 +583,7 @@ config RCU_FANOUT
    int "Tree-based hierarchical RCU fanout value"
    range 2 64 if 64BIT
    range 2 32 if !64BIT
    - depends on TREE_RCU || PREEMPT_RCU
    + depends on (TREE_RCU || PREEMPT_RCU) && RCU_EXPERT
    default 64 if 64BIT
    default 32 if !64BIT
    help
    diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
    index 01719402fe8e..4b27a7c0926f 100644
    --- a/kernel/rcu/tree.c
    +++ b/kernel/rcu/tree.c
    @@ -3966,7 +3966,7 @@ static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
    if (rcu_fanout_exact) {
    levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
    for (i = rcu_num_lvls - 2; i >= 0; i--)
    - levelspread[i] = CONFIG_RCU_FANOUT;
    + levelspread[i] = RCU_FANOUT;
    } else {
    int ccur;
    int cprv;
    @@ -4097,7 +4097,7 @@ static void __init rcu_init_geometry(void)
    */
    rcu_capacity[0] = rcu_fanout_leaf;
    for (i = 1; i < RCU_NUM_LVLS; i++)
    - rcu_capacity[i] = rcu_capacity[i - 1] * CONFIG_RCU_FANOUT;
    + rcu_capacity[i] = rcu_capacity[i - 1] * RCU_FANOUT;

    /*
    * The tree must be able to accommodate the configured number of CPUs.
    diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
    index 5f294267ed20..7ca17b646428 100644
    --- a/kernel/rcu/tree.h
    +++ b/kernel/rcu/tree.h
    @@ -35,10 +35,21 @@
    * In practice, this did work well going from three levels to four.
    * Of course, your mileage may vary.
    */
    +
    +#ifdef CONFIG_RCU_FANOUT
    +#define RCU_FANOUT CONFIG_RCU_FANOUT
    +#else /* #ifdef CONFIG_RCU_FANOUT */
    +# ifdef CONFIG_64BIT
    +# define RCU_FANOUT 64
    +# else
    +# define RCU_FANOUT 32
    +# endif
    +#endif /* #else #ifdef CONFIG_RCU_FANOUT */
    +
    #define RCU_FANOUT_1 (CONFIG_RCU_FANOUT_LEAF)
    -#define RCU_FANOUT_2 (RCU_FANOUT_1 * CONFIG_RCU_FANOUT)
    -#define RCU_FANOUT_3 (RCU_FANOUT_2 * CONFIG_RCU_FANOUT)
    -#define RCU_FANOUT_4 (RCU_FANOUT_3 * CONFIG_RCU_FANOUT)
    +#define RCU_FANOUT_2 (RCU_FANOUT_1 * RCU_FANOUT)
    +#define RCU_FANOUT_3 (RCU_FANOUT_2 * RCU_FANOUT)
    +#define RCU_FANOUT_4 (RCU_FANOUT_3 * RCU_FANOUT)

    #if NR_CPUS <= RCU_FANOUT_1
    # define RCU_NUM_LVLS 1
    diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
    index 3eb1cda880c8..ca0f54cbba0e 100644
    --- a/kernel/rcu/tree_plugin.h
    +++ b/kernel/rcu/tree_plugin.h
    @@ -60,10 +60,10 @@ static void __init rcu_bootup_announce_oddness(void)
    {
    if (IS_ENABLED(CONFIG_RCU_TRACE))
    pr_info("\tRCU debugfs-based tracing is enabled.\n");
    - if ((IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 64) ||
    - (!IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 32))
    + if ((IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 64) ||
    + (!IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 32))
    pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
    - CONFIG_RCU_FANOUT);
    + RCU_FANOUT);
    if (rcu_fanout_exact)
    pr_info("\tHierarchical RCU autobalancing is disabled.\n");
    if (IS_ENABLED(CONFIG_RCU_FAST_NO_HZ))
    --
    1.8.1.5


    \
     
     \ /
      Last update: 2015-05-13 00:41    [W:2.934 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site