aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-12-17 11:35:02 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-01-16 02:33:15 -0500
commitfb81a44b88e6173ed0f6e9d6a1afa5305fb63f6e (patch)
treefaa68798164b89dd6d37a9a591e62e9dfc7afdad
parent5cd37193ce8539be1e6ef76be226f4bcc984e0f5 (diff)
rcu: Add GP-kthread-starvation checks to CPU stall warnings
This commit adds a message that is printed if the relevant grace-period kthread has not been able to run for the two seconds preceding the stall warning. (The two seconds is double the maximum interval between successive bouts of quiescent-state forcing.) Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--Documentation/RCU/stallwarn.txt9
-rw-r--r--kernel/rcu/tree.c21
2 files changed, 29 insertions, 1 deletions
diff --git a/Documentation/RCU/stallwarn.txt b/Documentation/RCU/stallwarn.txt
index 55f9707fe60a..53e7d2856db6 100644
--- a/Documentation/RCU/stallwarn.txt
+++ b/Documentation/RCU/stallwarn.txt
@@ -152,6 +152,15 @@ no non-lazy callbacks ("." is printed otherwise, as shown above) and
152"D" indicates that dyntick-idle processing is enabled ("." is printed 152"D" indicates that dyntick-idle processing is enabled ("." is printed
153otherwise, for example, if disabled via the "nohz=" kernel boot parameter). 153otherwise, for example, if disabled via the "nohz=" kernel boot parameter).
154 154
155If the relevant grace-period kthread has been unable to run prior to
156the stall warning, the following additional line is printed:
157
158 rcu_preempt kthread starved for 2023 jiffies!
159
160Starving the grace-period kthreads of CPU time can of course result in
161RCU CPU stall warnings even when all CPUs and tasks have passed through
162the required quiescent states.
163
155 164
156Multiple Warnings From One Stall 165Multiple Warnings From One Stall
157 166
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index cb00e038c2f2..e335f33d0b9f 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1073,6 +1073,21 @@ static void record_gp_stall_check_time(struct rcu_state *rsp)
1073} 1073}
1074 1074
1075/* 1075/*
1076 * Complain about starvation of grace-period kthread.
1077 */
1078static void rcu_check_gp_kthread_starvation(struct rcu_state *rsp)
1079{
1080 unsigned long gpa;
1081 unsigned long j;
1082
1083 j = jiffies;
1084 gpa = ACCESS_ONCE(rsp->gp_activity);
1085 if (j - gpa > 2 * HZ)
1086 pr_err("%s kthread starved for %ld jiffies!\n",
1087 rsp->name, j - gpa);
1088}
1089
1090/*
1076 * Dump stacks of all tasks running on stalled CPUs. 1091 * Dump stacks of all tasks running on stalled CPUs.
1077 */ 1092 */
1078static void rcu_dump_cpu_stacks(struct rcu_state *rsp) 1093static void rcu_dump_cpu_stacks(struct rcu_state *rsp)
@@ -1169,9 +1184,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum)
1169 } 1184 }
1170 1185
1171 /* Complain about tasks blocking the grace period. */ 1186 /* Complain about tasks blocking the grace period. */
1172
1173 rcu_print_detail_task_stall(rsp); 1187 rcu_print_detail_task_stall(rsp);
1174 1188
1189 rcu_check_gp_kthread_starvation(rsp);
1190
1175 force_quiescent_state(rsp); /* Kick them all. */ 1191 force_quiescent_state(rsp); /* Kick them all. */
1176} 1192}
1177 1193
@@ -1196,6 +1212,9 @@ static void print_cpu_stall(struct rcu_state *rsp)
1196 pr_cont(" (t=%lu jiffies g=%ld c=%ld q=%lu)\n", 1212 pr_cont(" (t=%lu jiffies g=%ld c=%ld q=%lu)\n",
1197 jiffies - rsp->gp_start, 1213 jiffies - rsp->gp_start,
1198 (long)rsp->gpnum, (long)rsp->completed, totqlen); 1214 (long)rsp->gpnum, (long)rsp->completed, totqlen);
1215
1216 rcu_check_gp_kthread_starvation(rsp);
1217
1199 rcu_dump_cpu_stacks(rsp); 1218 rcu_dump_cpu_stacks(rsp);
1200 1219
1201 raw_spin_lock_irqsave(&rnp->lock, flags); 1220 raw_spin_lock_irqsave(&rnp->lock, flags);