[patch 2/2] sched/debug: Remove need_resched ratelimiting for warnings

From: David Rientjes
Date: Mon Jan 06 2025 - 15:39:38 EST


The need_resched warnings are controlled by two tunables in debugfs:
- latency_warn_ms
- latency_warn_once

By default, latency_warn_once is enabled. Thus, a need_resched warning
is only emitted once per boot.

If the user configures this to not be the case and changes the default,
then allow the user to also control the threshold through latency_warn_ms
that these warnings trigger. Do not impose our own ratelimiting on top
that may make it appear like there are no cases where need_resched is set
for longer than the threshold.

Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---
kernel/sched/debug.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -1293,11 +1293,6 @@ void proc_sched_set_task(struct task_struct *p)

void resched_latency_warn(int cpu, u64 latency)
{
- static DEFINE_RATELIMIT_STATE(latency_check_ratelimit, 60 * 60 * HZ, 1);
-
- 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();