mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 1/2] sched/debug: Change need_resched warnings to pr_err
@ 2025-01-06 20:39 David Rientjes
  2025-01-06 21:59 ` Josh Don
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Rientjes @ 2025-01-06 20:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, linux-kernel

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>
---
 kernel/sched/debug.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -1295,8 +1295,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();
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-15  9:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-06 20:39 [patch 1/2] sched/debug: Change need_resched warnings to pr_err David Rientjes
2025-01-06 21:59 ` Josh Don
2025-01-07 19:18 ` Madadi Vineeth Reddy
2025-01-07 20:13   ` David Rientjes
2025-01-10  0:24 ` [patch v2] " David Rientjes
2025-01-15  9:17   ` [tip: sched/core] " tip-bot2 for David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®