Skip to content

Commit 1ecd9d6

Browse files
paulmckrcuNeeraj Upadhyay
authored andcommitted
rcu: Defer printing stall-warning backtrace when holding rcu_node lock
The rcu_dump_cpu_stacks() holds the leaf rcu_node structure's ->lock when dumping the stakcks of any CPUs stalling the current grace period. This lock is held to prevent confusion that would otherwise occur when the stalled CPU reported its quiescent state (and then went on to do unrelated things) just as the backtrace NMI was heading towards it. This has worked well, but on larger systems has recently been observed to cause severe lock contention resulting in CSD-lock stalls and other general unhappiness. This commit therefore does printk_deferred_enter() before acquiring the lock and printk_deferred_exit() after releasing it, thus deferring the overhead of actually outputting the stack trace out of that lock's critical section. Reported-by: Rik van Riel <[email protected]> Suggested-by: Rik van Riel <[email protected]> Signed-off-by: "Paul E. McKenney" <[email protected]> Signed-off-by: Neeraj Upadhyay <[email protected]>
1 parent 51b7399 commit 1ecd9d6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/rcu/tree_stall.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ static void rcu_dump_cpu_stacks(void)
371371
struct rcu_node *rnp;
372372

373373
rcu_for_each_leaf_node(rnp) {
374+
printk_deferred_enter();
374375
raw_spin_lock_irqsave_rcu_node(rnp, flags);
375376
for_each_leaf_node_possible_cpu(rnp, cpu)
376377
if (rnp->qsmask & leaf_node_cpu_bit(rnp, cpu)) {
@@ -380,6 +381,7 @@ static void rcu_dump_cpu_stacks(void)
380381
dump_cpu_task(cpu);
381382
}
382383
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
384+
printk_deferred_exit();
383385
}
384386
}
385387

0 commit comments

Comments
 (0)