Skip to content

Commit

Permalink
sched/debug: Change need_resched warnings to pr_err
Browse files Browse the repository at this point in the history
need_resched warnings, if enabled, are treated as WARNINGs.  If
kernel.panic_on_warn is enabled, then this causes a kernel panic.

It's highly unlikely that a panic is desired for these warnings, only a
stack trace is normally required to debug and resolve.

Thus, switch need_resched warnings to simply be a printk with an
associated stack trace so they are no longer in scope for panic_on_warn.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Acked-by: Josh Don <joshdon@google.com>
Link: https://lkml.kernel.org/r/e8d52023-5291-26bd-5299-8bb9eb604929@google.com
  • Loading branch information
David Rientjes authored and Peter Zijlstra committed Jan 13, 2025
1 parent 2cf9ac4 commit 8061b9f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kernel/sched/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,10 @@ void resched_latency_warn(int cpu, u64 latency)
{
static DEFINE_RATELIMIT_STATE(latency_check_ratelimit, 60 * 60 * HZ, 1);

WARN(__ratelimit(&latency_check_ratelimit),
"sched: CPU %d need_resched set for > %llu ns (%d ticks) "
"without schedule\n",
cpu, latency, cpu_rq(cpu)->ticks_without_resched);
if (likely(!__ratelimit(&latency_check_ratelimit)))
return;

pr_err("sched: CPU %d need_resched set for > %llu ns (%d ticks) without schedule\n",
cpu, latency, cpu_rq(cpu)->ticks_without_resched);
dump_stack();
}

0 comments on commit 8061b9f

Please sign in to comment.