public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: gmonaco@redhat.com
To: Peter Zijlstra <peterz@infradead.org>,
	linux-trace-kernel@vger.kernel.org,
		linux-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Nam Cao <namcao@linutronix.de>,  Juri Lelli <jlelli@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	 K Prateek Nayak <kprateek.nayak@amd.com>,
	Tomas Glozar <tglozar@redhat.com>,
	Clark Williams <williams@redhat.com>,
	 John Kacur <jkacur@redhat.com>
Subject: Re: [PATCH v7 08/15] sched: Add task enqueue/dequeue trace points
Date: Wed, 18 Mar 2026 16:44:34 +0100	[thread overview]
Message-ID: <93326862189ea258b17edfd2a272be82834092fa.camel@redhat.com> (raw)
In-Reply-To: <20260310105627.332044-9-gmonaco@redhat.com>

Hi Peter,

On Tue, 2026-03-10 at 11:56 +0100, Gabriele Monaco wrote:
> From: Nam Cao <namcao@linutronix.de>
> 
> Add trace points into enqueue_task() and dequeue_task().
> 
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Co-developed-by: Gabriele Monaco <gmonaco@redhat.com>
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---

Could I get an Ack for this?

Thanks,
Gabriele

> 
> Notes:
>     V7:
>     * Use cpu_of(rq) helper in tracepoint calls
>     V5:
>     * Do not fire enqueue tracepoint for delayed enqueues
> 
>  include/trace/events/sched.h |  8 ++++++++
>  kernel/sched/core.c          | 12 +++++++++++-
>  kernel/sched/sched.h         |  2 ++
>  3 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/include/trace/events/sched.h
> b/include/trace/events/sched.h
> index 7b2645b50e78..5844147ec5fd 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -896,6 +896,14 @@ DECLARE_TRACE(sched_set_need_resched,
>  	TP_PROTO(struct task_struct *tsk, int cpu, int tif),
>  	TP_ARGS(tsk, cpu, tif));
>  
> +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 b7f77c165a6e..c9ca1e048612 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -122,6 +122,8 @@
> EXPORT_TRACEPOINT_SYMBOL_GPL(sched_compute_energy_tp);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(sched_entry_tp);
>  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);
>  
>  DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
>  DEFINE_PER_CPU(struct rnd_state, sched_rnd_state);
> @@ -2094,6 +2096,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, cpu_of(rq));
> +
>  	if (!(flags & ENQUEUE_NOCLOCK))
>  		update_rq_clock(rq);
>  
> @@ -2120,6 +2125,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)
>  {
> +	bool ret;
> +
>  	if (sched_core_enabled(rq))
>  		sched_core_dequeue(rq, p, flags);
>  
> @@ -2136,7 +2143,10 @@ inline bool dequeue_task(struct rq *rq, struct
> task_struct *p, int flags)
>  	 * and mark the task ->sched_delayed.
>  	 */
>  	uclamp_rq_dec(rq, p);
> -	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, cpu_of(rq));
> +	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 43bbf0693cca..d7ab0aa58a70 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2955,6 +2955,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, cpu_of(rq));
> +
>  	if (p->sched_contributes_to_load)
>  		rq->nr_uninterruptible++;
>  


  reply	other threads:[~2026-03-18 15:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 10:56 [PATCH v7 00/15] rv: Add Hybrid Automata monitor type, per-object and deadline monitors Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 01/15] rv: Unify DA event handling functions across monitor types Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 02/15] rv: Add Hybrid Automata monitor type Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 03/15] verification/rvgen: Allow spaces in and events strings Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 04/15] verification/rvgen: Add support for Hybrid Automata Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 05/15] Documentation/rv: Add documentation about hybrid automata Gabriele Monaco
2026-03-12 10:39   ` Juri Lelli
2026-03-13 13:05     ` gmonaco
2026-03-13 13:23       ` Juri Lelli
2026-03-10 10:56 ` [PATCH v7 06/15] rv: Add sample hybrid monitors stall Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 07/15] rv: Convert the opid monitor to a hybrid automaton Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 08/15] sched: Add task enqueue/dequeue trace points Gabriele Monaco
2026-03-18 15:44   ` gmonaco [this message]
2026-03-10 10:56 ` [PATCH v7 09/15] rv: Add enqueue/dequeue to snroc monitor Gabriele Monaco
2026-03-23  9:06   ` Nam Cao
2026-03-10 10:56 ` [PATCH v7 10/15] rv: Add support for per-object monitors in DA/HA Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 11/15] verification/rvgen: Add support for per-obj monitors Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 12/15] sched: Add deadline tracepoints Gabriele Monaco
2026-03-12 13:07   ` Juri Lelli
2026-03-10 10:56 ` [PATCH v7 13/15] sched/deadline: Move some utility functions to deadline.h Gabriele Monaco
2026-03-10 10:56 ` [PATCH v7 14/15] rv: Add deadline monitors Gabriele Monaco
2026-03-12 13:37   ` Juri Lelli
2026-03-18 12:00     ` gmonaco
2026-03-10 10:56 ` [PATCH v7 15/15] rv: Add dl_server specific monitors Gabriele Monaco
2026-03-12 13:55   ` 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=93326862189ea258b17edfd2a272be82834092fa.camel@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=mhiramat@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