lkml.org 
[lkml]   [2020]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.5 010/542] rcu/nocb: Fix dump_tree hierarchy print always active
    Date
    From: Stefan Reiter <stefan@pimaker.at>

    [ Upstream commit 610dea36d3083a977e4f156206cbe1eaa2a532f0 ]

    Commit 18cd8c93e69e ("rcu/nocb: Print gp/cb kthread hierarchy if
    dump_tree") added print statements to rcu_organize_nocb_kthreads for
    debugging, but incorrectly guarded them, causing the function to always
    spew out its message.

    This patch fixes it by guarding both pr_alert statements with dump_tree,
    while also changing the second pr_alert to a pr_cont, to print the
    hierarchy in a single line (assuming that's how it was supposed to
    work).

    Fixes: 18cd8c93e69e ("rcu/nocb: Print gp/cb kthread hierarchy if dump_tree")
    Signed-off-by: Stefan Reiter <stefan@pimaker.at>
    [ paulmck: Make single-nocbs-CPU GP kthreads look less erroneous. ]
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    kernel/rcu/tree_plugin.h | 22 +++++++++++++++++-----
    1 file changed, 17 insertions(+), 5 deletions(-)

    diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
    index f849e7429816f..f7118842a2b88 100644
    --- a/kernel/rcu/tree_plugin.h
    +++ b/kernel/rcu/tree_plugin.h
    @@ -2322,6 +2322,8 @@ static void __init rcu_organize_nocb_kthreads(void)
    {
    int cpu;
    bool firsttime = true;
    + bool gotnocbs = false;
    + bool gotnocbscbs = true;
    int ls = rcu_nocb_gp_stride;
    int nl = 0; /* Next GP kthread. */
    struct rcu_data *rdp;
    @@ -2344,21 +2346,31 @@ static void __init rcu_organize_nocb_kthreads(void)
    rdp = per_cpu_ptr(&rcu_data, cpu);
    if (rdp->cpu >= nl) {
    /* New GP kthread, set up for CBs & next GP. */
    + gotnocbs = true;
    nl = DIV_ROUND_UP(rdp->cpu + 1, ls) * ls;
    rdp->nocb_gp_rdp = rdp;
    rdp_gp = rdp;
    - if (!firsttime && dump_tree)
    - pr_cont("\n");
    - firsttime = false;
    - pr_alert("%s: No-CB GP kthread CPU %d:", __func__, cpu);
    + if (dump_tree) {
    + if (!firsttime)
    + pr_cont("%s\n", gotnocbscbs
    + ? "" : " (self only)");
    + gotnocbscbs = false;
    + firsttime = false;
    + pr_alert("%s: No-CB GP kthread CPU %d:",
    + __func__, cpu);
    + }
    } else {
    /* Another CB kthread, link to previous GP kthread. */
    + gotnocbscbs = true;
    rdp->nocb_gp_rdp = rdp_gp;
    rdp_prev->nocb_next_cb_rdp = rdp;
    - pr_alert(" %d", cpu);
    + if (dump_tree)
    + pr_cont(" %d", cpu);
    }
    rdp_prev = rdp;
    }
    + if (gotnocbs && dump_tree)
    + pr_cont("%s\n", gotnocbscbs ? "" : " (self only)");
    }

    /*
    --
    2.20.1
    \
     
     \ /
      Last update: 2020-02-14 16:49    [W:2.090 / U:0.416 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site