Re: [PATCH v6 12/16] sched: Add deadline tracepoints

From: Juri Lelli

Date: Mon Mar 02 2026 - 09:24:58 EST


Hello,

On 25/02/26 10:51, Gabriele Monaco wrote:
> Add the following tracepoints:
>
> * sched_dl_throttle(dl_se, cpu, type):
> Called when a deadline entity is throttled
> * sched_dl_replenish(dl_se, cpu, type):
> Called when a deadline entity's runtime is replenished
> * sched_dl_update(dl_se, cpu, type):
> Called when a deadline entity updates without throttle or replenish
> * sched_dl_server_start(dl_se, cpu, type):
> Called when a deadline server is started
> * sched_dl_server_stop(dl_se, cpu, type):
> Called when a deadline server is stopped
>
> Those tracepoints can be useful to validate the deadline scheduler with
> RV and are not exported to tracefs.
>
> Reviewed-by: Phil Auld <pauld@xxxxxxxxxx>
> Signed-off-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
> ---
>
> Notes:
> V6:
> * Add dl_se type to differentiate between fair and ext servers
> * Add event to track dl_update_curr not firing other events
> V3:
> * Rename dl argument to dl_se in tracepoints
>
> include/trace/events/sched.h | 26 ++++++++++++++++++++++++++
> kernel/sched/core.c | 4 ++++
> kernel/sched/deadline.c | 25 ++++++++++++++++++++++++-
> 3 files changed, 54 insertions(+), 1 deletion(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 5844147ec5fd..944d65750a64 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -904,6 +904,32 @@ DECLARE_TRACE(sched_dequeue,
> TP_PROTO(struct task_struct *tsk, int cpu),
> TP_ARGS(tsk, cpu));
>
> +#define DL_OTHER 0
> +#define DL_TASK 1
> +#define DL_SERVER_FAIR 2
> +#define DL_SERVER_EXT 3
> +
> +DECLARE_TRACE(sched_dl_throttle,
> + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type),
> + TP_ARGS(dl_se, cpu, type));
> +
> +DECLARE_TRACE(sched_dl_replenish,
> + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type),
> + TP_ARGS(dl_se, cpu, type));
> +
> +/* Call to update_curr_dl_se not involving throttle or replenish */
> +DECLARE_TRACE(sched_dl_update,
> + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type),
> + TP_ARGS(dl_se, cpu, type));
> +
> +DECLARE_TRACE(sched_dl_server_start,
> + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type),
> + TP_ARGS(dl_se, cpu, type));
> +
> +DECLARE_TRACE(sched_dl_server_stop,
> + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type),
> + TP_ARGS(dl_se, cpu, type));
> +
> #endif /* _TRACE_SCHED_H */
>
> /* This part must be outside protection */
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 4ca79ff58fca..b5bb2eb112bf 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -124,6 +124,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_exit_tp);
> EXPORT_TRACEPOINT_SYMBOL_GPL(sched_set_need_resched_tp);
> EXPORT_TRACEPOINT_SYMBOL_GPL(sched_enqueue_tp);
> EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dequeue_tp);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_throttle_tp);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_replenish_tp);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_server_start_tp);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_server_stop_tp);

Don't we need to export sched_dl_update_tp as well?

> DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
> DEFINE_PER_CPU(struct rnd_state, sched_rnd_state);

...

> @@ -1532,7 +1551,8 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
>
> if (!is_leftmost(dl_se, &rq->dl))
> resched_curr(rq);
> - }
> + } else
> + trace_sched_dl_update_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq));

This wants braces even if it's a single statement.

>
> /*
> * The dl_server does not account for real-time workload because it

Thanks,
Juri