diff options
| author | Byungchul Park <byungchul.park@lge.com> | 2016-11-09 03:57:13 -0500 | 
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-01-23 14:32:22 -0500 | 
| commit | c4402b27f1778fad0dbc27b2d88bb06ca22a06f0 (patch) | |
| tree | 5dbdefa7e7b390a9971246f0541673a563467d2a /kernel/rcu/tree.c | |
| parent | 907565337ebf998a68cb5c5b2174ce5e5da065eb (diff) | |
rcu: Only dump stalled-tasks stacks if there was a real stall
The print_other_cpu_stall() function currently unconditionally invokes
rcu_print_detail_task_stall().  This is OK because if there was a stall
sufficient to cause print_other_cpu_stall() to be invoked, that stall
is very likely to persist through the entire print_other_cpu_stall()
execution.  However, if the stall did not persist, the variable ndetected
will be zero, and that variable is already tested in an "if" statement.
Therefore, this commit moves the call to rcu_print_detail_task_stall()
under that pre-existing "if" to improve readability, with a very rare
reduction in overhead.
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
[ paulmck: Reworked commit log. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcu/tree.c')
| -rw-r--r-- | kernel/rcu/tree.c | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index cb4e2056ccf3..6232d2f9a84e 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -1379,6 +1379,9 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum) | |||
| 1379 | (long)rsp->gpnum, (long)rsp->completed, totqlen); | 1379 | (long)rsp->gpnum, (long)rsp->completed, totqlen); | 
| 1380 | if (ndetected) { | 1380 | if (ndetected) { | 
| 1381 | rcu_dump_cpu_stacks(rsp); | 1381 | rcu_dump_cpu_stacks(rsp); | 
| 1382 | |||
| 1383 | /* Complain about tasks blocking the grace period. */ | ||
| 1384 | rcu_print_detail_task_stall(rsp); | ||
| 1382 | } else { | 1385 | } else { | 
| 1383 | if (READ_ONCE(rsp->gpnum) != gpnum || | 1386 | if (READ_ONCE(rsp->gpnum) != gpnum || | 
| 1384 | READ_ONCE(rsp->completed) == gpnum) { | 1387 | READ_ONCE(rsp->completed) == gpnum) { | 
| @@ -1395,9 +1398,6 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum) | |||
| 1395 | } | 1398 | } | 
| 1396 | } | 1399 | } | 
| 1397 | 1400 | ||
| 1398 | /* Complain about tasks blocking the grace period. */ | ||
| 1399 | rcu_print_detail_task_stall(rsp); | ||
| 1400 | |||
| 1401 | rcu_check_gp_kthread_starvation(rsp); | 1401 | rcu_check_gp_kthread_starvation(rsp); | 
| 1402 | 1402 | ||
| 1403 | panic_on_rcu_stall(); | 1403 | panic_on_rcu_stall(); | 
