From: Gabriele Monaco <gmonaco@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>,
Tomas Glozar <tglozar@redhat.com>,
Clark Williams <williams@redhat.com>,
John Kacur <jkacur@redhat.com>,
linux-trace-kernel@vger.kernel.org,
Ingo Molnar <mingo@redhat.com>, Nam Cao <namcao@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, Juri Lelli <jlelli@redhat.com>
Subject: Re: [PATCH v5 09/15] sched: Add task enqueue/dequeue trace points
Date: Tue, 27 Jan 2026 09:10:46 +0000 [thread overview]
Message-ID: <8883042e-49b4-4cba-b0f8-d12e4cfa3d6c@redhat.com> (raw)
In-Reply-To: <20260122155500.362683-10-gmonaco@redhat.com>
2026-01-22T15:56:08Z Gabriele Monaco <gmonaco@redhat.com>:
> From: Nam Cao <namcao@linutronix.de>
>
> Add trace points into enqueue_task() and dequeue_task().
>
Peter,
can I have your Ack on this?
(Apologies for the spam, I sent it as HTML by mistake)
Thanks,
Gabriele
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---
>
> Notes:
> V5:
> * Do not fire enqueue tracepoint for delayed enqueues
>
> include/trace/events/sched.h | 13 +++++++++++++
> kernel/sched/core.c | 10 +++++++++-
> kernel/sched/sched.h | 2 ++
> 3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 366b2e8ec40c..f4e1d3554e3e 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -912,6 +912,19 @@ DECLARE_TRACE(sched_dl_server_stop,
> TP_PROTO(struct sched_dl_entity *dl_se, int cpu),
> TP_ARGS(dl_se, cpu));
>
> +/*
> + * The two trace points below may not work as expected for fair tasks due
> + * to delayed dequeue. See:
> + * https://lore.kernel.org/lkml/179674c6-f82a-4718-ace2-67b5e672fdee@amd.com/
> + */
> +DECLARE_TRACE(sched_enqueue,
> + TP_PROTO(struct task_struct *tsk, int cpu),
> + TP_ARGS(tsk, cpu));
> +
> +DECLARE_TRACE(sched_dequeue,
> + TP_PROTO(struct task_struct *tsk, int cpu),
> + TP_ARGS(tsk, cpu));
> +
> #endif /* _TRACE_SCHED_H */
>
> /* This part must be outside protection */
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f6293fa02fb7..c885d7885172 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2087,6 +2087,9 @@ unsigned long get_wchan(struct task_struct *p)
>
> void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
> {
> + if (trace_sched_enqueue_tp_enabled() && !(flags & ENQUEUE_DELAYED))
> + trace_sched_enqueue_tp(p, rq->cpu);
> +
> if (!(flags & ENQUEUE_NOCLOCK))
> update_rq_clock(rq);
>
> @@ -2114,6 +2117,8 @@ void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
> */
> inline bool dequeue_task(struct rq *rq, struct task_struct *p, int flags)
> {
> + int ret;
> +
> if (sched_core_enabled(rq))
> sched_core_dequeue(rq, p, flags);
>
> @@ -2131,7 +2136,10 @@ inline bool dequeue_task(struct rq *rq, struct task_struct *p, int flags)
> */
> uclamp_rq_dec(rq, p);
> rq->queue_mask |= p->sched_class->queue_mask;
> - return p->sched_class->dequeue_task(rq, p, flags);
> + ret = p->sched_class->dequeue_task(rq, p, flags);
> + if (trace_sched_dequeue_tp_enabled() && !(flags & DEQUEUE_SLEEP))
> + trace_sched_dequeue_tp(p, rq->cpu);
> + return ret;
> }
>
> void activate_task(struct rq *rq, struct task_struct *p, int flags)
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index e885a935b716..8465472b40fa 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2918,6 +2918,8 @@ static inline void sub_nr_running(struct rq *rq, unsigned count)
>
> static inline void __block_task(struct rq *rq, struct task_struct *p)
> {
> + trace_sched_dequeue_tp(p, rq->cpu);
> +
> if (p->sched_contributes_to_load)
> rq->nr_uninterruptible++;
>
> --
> 2.52.0
next prev parent reply other threads:[~2026-01-27 9:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 15:54 [PATCH v5 00/15] rv: Add Hybrid Automata monitor type, per-object and deadline monitors Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 01/15] rv: Unify DA event handling functions across monitor types Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 02/15] rv: Add Hybrid Automata monitor type Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 03/15] verification/rvgen: Allow spaces in and events strings Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 04/15] verification/rvgen: Add support for Hybrid Automata Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 05/15] Documentation/rv: Add documentation about hybrid automata Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 06/15] rv: Add sample hybrid monitors stall Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 07/15] rv: Convert the opid monitor to a hybrid automaton Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 08/15] sched: Add deadline tracepoints Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 09/15] sched: Add task enqueue/dequeue trace points Gabriele Monaco
2026-01-27 9:10 ` Gabriele Monaco [this message]
2026-02-03 11:06 ` Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 10/15] rv: Add enqueue/dequeue to snroc monitor Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 11/15] rv: Add support for per-object monitors in DA/HA Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 12/15] verification/rvgen: Add support for per-obj monitors Gabriele Monaco
2026-01-22 15:54 ` [PATCH v5 13/15] sched/deadline: Move some utility functions to deadline.h Gabriele Monaco
2026-01-23 13:00 ` Juri Lelli
2026-01-22 15:54 ` [PATCH v5 14/15] rv: Add deadline monitors Gabriele Monaco
2026-01-23 13:03 ` Juri Lelli
2026-01-22 15:55 ` [PATCH v5 15/15] rv: Add dl_server specific monitors Gabriele Monaco
2026-01-23 13:04 ` Juri Lelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8883042e-49b4-4cba-b0f8-d12e4cfa3d6c@redhat.com \
--to=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=jlelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namcao@linutronix.de \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox