[PATCH] sched/debug: add new tracepoints to track rt throttling

From: wen . yang
Date: Tue Nov 18 2025 - 11:11:08 EST


From: Wen Yang <wen.yang@xxxxxxxxx>

The new tracepoint allows for tracking RT throttling events at
the rt_rq level to identify RT processes that use a large amount
of CPU.

Signed-off-by: Wen Yang <wen.yang@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ben Segall <bsegall@xxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
include/linux/sched.h | 1 +
include/trace/events/sched.h | 5 +++++
kernel/sched/rt.c | 1 +
3 files changed, 7 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 40a6027a2cfd..210cf5ce41be 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -78,6 +78,7 @@ struct reclaim_state;
struct robust_list_head;
struct root_domain;
struct rq;
+struct rt_rq;
struct sched_attr;
struct sched_dl_entity;
struct seq_file;
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 7b2645b50e78..9ec53bc98df9 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -896,6 +896,11 @@ DECLARE_TRACE(sched_set_need_resched,
TP_PROTO(struct task_struct *tsk, int cpu, int tif),
TP_ARGS(tsk, cpu, tif));

+DECLARE_TRACE(sched_rt_throttled,
+ TP_PROTO(struct rt_rq *rt_rq),
+ TP_ARGS(rt_rq));
+
+
#endif /* _TRACE_SCHED_H */

/* This part must be outside protection */
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index f1867fe8e5c5..c04762a51ff0 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -884,6 +884,7 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
*/
if (likely(rt_b->rt_runtime)) {
rt_rq->rt_throttled = 1;
+ trace_sched_rt_throttled_tp(rt_rq);
printk_deferred_once("sched: RT throttling activated\n");
} else {
/*
--
2.25.1