Skip to content

Commit 610dea3

Browse files
PiMakerpaulmckrcu
authored andcommitted
rcu/nocb: Fix dump_tree hierarchy print always active
Commit 18cd8c9 ("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: 18cd8c9 ("rcu/nocb: Print gp/cb kthread hierarchy if dump_tree") Signed-off-by: Stefan Reiter <[email protected]> [ paulmck: Make single-nocbs-CPU GP kthreads look less erroneous. ] Signed-off-by: Paul E. McKenney <[email protected]>
1 parent e42617b commit 610dea3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,8 @@ static void __init rcu_organize_nocb_kthreads(void)
23212321
{
23222322
int cpu;
23232323
bool firsttime = true;
2324+
bool gotnocbs = false;
2325+
bool gotnocbscbs = true;
23242326
int ls = rcu_nocb_gp_stride;
23252327
int nl = 0; /* Next GP kthread. */
23262328
struct rcu_data *rdp;
@@ -2343,21 +2345,31 @@ static void __init rcu_organize_nocb_kthreads(void)
23432345
rdp = per_cpu_ptr(&rcu_data, cpu);
23442346
if (rdp->cpu >= nl) {
23452347
/* New GP kthread, set up for CBs & next GP. */
2348+
gotnocbs = true;
23462349
nl = DIV_ROUND_UP(rdp->cpu + 1, ls) * ls;
23472350
rdp->nocb_gp_rdp = rdp;
23482351
rdp_gp = rdp;
2349-
if (!firsttime && dump_tree)
2350-
pr_cont("\n");
2351-
firsttime = false;
2352-
pr_alert("%s: No-CB GP kthread CPU %d:", __func__, cpu);
2352+
if (dump_tree) {
2353+
if (!firsttime)
2354+
pr_cont("%s\n", gotnocbscbs
2355+
? "" : " (self only)");
2356+
gotnocbscbs = false;
2357+
firsttime = false;
2358+
pr_alert("%s: No-CB GP kthread CPU %d:",
2359+
__func__, cpu);
2360+
}
23532361
} else {
23542362
/* Another CB kthread, link to previous GP kthread. */
2363+
gotnocbscbs = true;
23552364
rdp->nocb_gp_rdp = rdp_gp;
23562365
rdp_prev->nocb_next_cb_rdp = rdp;
2357-
pr_alert(" %d", cpu);
2366+
if (dump_tree)
2367+
pr_cont(" %d", cpu);
23582368
}
23592369
rdp_prev = rdp;
23602370
}
2371+
if (gotnocbs && dump_tree)
2372+
pr_cont("%s\n", gotnocbscbs ? "" : " (self only)");
23612373
}
23622374

23632375
/*

0 commit comments

Comments
 (0)