Skip to content

Commit

Permalink
rcu: Add GP-kthread-starvation checks to CPU stall warnings
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul E. McKenney committed Jan 16, 2015
1 parent 5cd3719 commit fb81a44
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Documentation/RCU/stallwarn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ no non-lazy callbacks ("." is printed otherwise, as shown above) and
"D" indicates that dyntick-idle processing is enabled ("." is printed
otherwise, for example, if disabled via the "nohz=" kernel boot parameter).

If the relevant grace-period kthread has been unable to run prior to
the stall warning, the following additional line is printed:

rcu_preempt kthread starved for 2023 jiffies!

Starving the grace-period kthreads of CPU time can of course result in
RCU CPU stall warnings even when all CPUs and tasks have passed through
the required quiescent states.


Multiple Warnings From One Stall

Expand Down
21 changes: 20 additions & 1 deletion kernel/rcu/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,21 @@ static void record_gp_stall_check_time(struct rcu_state *rsp)
rsp->n_force_qs_gpstart = ACCESS_ONCE(rsp->n_force_qs);
}

/*
* Complain about starvation of grace-period kthread.
*/
static void rcu_check_gp_kthread_starvation(struct rcu_state *rsp)
{
unsigned long gpa;
unsigned long j;

j = jiffies;
gpa = ACCESS_ONCE(rsp->gp_activity);
if (j - gpa > 2 * HZ)
pr_err("%s kthread starved for %ld jiffies!\n",
rsp->name, j - gpa);
}

/*
* Dump stacks of all tasks running on stalled CPUs.
*/
Expand Down Expand Up @@ -1169,9 +1184,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum)
}

/* Complain about tasks blocking the grace period. */

rcu_print_detail_task_stall(rsp);

rcu_check_gp_kthread_starvation(rsp);

force_quiescent_state(rsp); /* Kick them all. */
}

Expand All @@ -1196,6 +1212,9 @@ static void print_cpu_stall(struct rcu_state *rsp)
pr_cont(" (t=%lu jiffies g=%ld c=%ld q=%lu)\n",
jiffies - rsp->gp_start,
(long)rsp->gpnum, (long)rsp->completed, totqlen);

rcu_check_gp_kthread_starvation(rsp);

rcu_dump_cpu_stacks(rsp);

raw_spin_lock_irqsave(&rnp->lock, flags);
Expand Down

0 comments on commit fb81a44

Please sign in to comment.