From: Peter Zijlstra <peterz@infradead.org>
To: Prakash Sangappa <prakash.sangappa@oracle.com>
Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, tglx@linutronix.de,
bigeasy@linutronix.de, kprateek.nayak@amd.com
Subject: Re: [PATCH V3 4/4] Sched: Add tracepoint for sched time slice extension
Date: Fri, 2 May 2025 11:14:34 +0200 [thread overview]
Message-ID: <20250502091434.GV4198@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250502015955.3146733-5-prakash.sangappa@oracle.com>
On Fri, May 02, 2025 at 01:59:55AM +0000, Prakash Sangappa wrote:
> Trace task's preemption due to a wakeups, getting delayed. Which
> can occurs when the running task requested extra time on cpu.
> Also, indicate the NEED_RESCHED flag set on the task getting
> cleared.
>
> Signed-off-by: Prakash Sangappa <prakash.sangappa@oracle.com>
> ---
> include/trace/events/sched.h | 28 ++++++++++++++++++++++++++++
> kernel/entry/common.c | 8 ++++++--
> 2 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 8994e97d86c1..4aa04044b14a 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -296,6 +296,34 @@ TRACE_EVENT(sched_migrate_task,
> __entry->orig_cpu, __entry->dest_cpu)
> );
>
> +/*
> + * Tracepoint for delayed resched requested by task:
> + */
> +TRACE_EVENT(sched_delay_resched,
> +
> + TP_PROTO(struct task_struct *p, unsigned int resched_flg),
> +
> + TP_ARGS(p, resched_flg),
> +
> + TP_STRUCT__entry(
> + __array( char, comm, TASK_COMM_LEN )
> + __field( pid_t, pid )
> + __field( int, cpu )
> + __field( int, flg )
> + ),
> +
> + TP_fast_assign(
> + memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
> + __entry->pid = p->pid;
> + __entry->cpu = task_cpu(p);
> + __entry->flg = resched_flg;
> + ),
> +
> + TP_printk("comm=%s pid=%d cpu=%d resched_flg_cleared=0x%x",
> + __entry->comm, __entry->pid, __entry->cpu, __entry->flg)
> +
> +);
> +
> DECLARE_EVENT_CLASS(sched_process_template,
>
> TP_PROTO(struct task_struct *p),
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index b26adccb32df..1951e6a4e9bc 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -12,6 +12,7 @@
>
> #include "common.h"
>
> +#include <trace/events/sched.h>
> #define CREATE_TRACE_POINTS
> #include <trace/events/syscalls.h>
>
> @@ -100,9 +101,12 @@ __always_inline unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
> local_irq_enable_exit_to_user(ti_work);
>
> if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
> - if (irq && rseq_delay_resched())
> + if (irq && rseq_delay_resched()) {
> clear_tsk_need_resched(current);
> - else
> + trace_sched_delay_resched(current,
> + ti_work & (_TIF_NEED_RESCHED |
> + _TIF_NEED_RESCHED_LAZY));
> + } else
> schedule();
> }
This is horrific coding style. But really why do we need this? I'm not,
in general, a fan of tracepoints.
next prev parent reply other threads:[~2025-05-02 9:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 1:59 [PATCH V3 0/4] Scheduler " Prakash Sangappa
2025-05-02 1:59 ` [PATCH V3 1/4] Sched: " Prakash Sangappa
2025-05-02 9:05 ` Peter Zijlstra
2025-05-02 13:06 ` Steven Rostedt
2025-05-05 1:51 ` Prakash Sangappa
2025-05-05 14:48 ` Steven Rostedt
2025-05-05 15:58 ` Prakash Sangappa
2025-05-05 16:34 ` Steven Rostedt
2025-05-05 16:45 ` Steven Rostedt
2025-05-06 1:23 ` Prakash Sangappa
2025-05-06 13:13 ` Steven Rostedt
2025-05-02 15:39 ` Mathieu Desnoyers
2025-05-05 1:46 ` Prakash Sangappa
2025-05-05 1:42 ` Prakash Sangappa
2025-05-02 12:34 ` Sebastian Andrzej Siewior
2025-05-02 14:35 ` Peter Zijlstra
2025-05-02 15:27 ` Sebastian Andrzej Siewior
2025-05-02 1:59 ` [PATCH V3 2/4] Sched: Tunable to specify duration of " Prakash Sangappa
2025-05-02 1:59 ` [PATCH V3 3/4] Sched: Add scheduler stat for cpu " Prakash Sangappa
2025-05-02 1:59 ` [PATCH V3 4/4] Sched: Add tracepoint for sched " Prakash Sangappa
2025-05-02 9:14 ` Peter Zijlstra [this message]
2025-05-02 11:02 ` Sebastian Andrzej Siewior
2025-05-02 11:10 ` Peter Zijlstra
2025-05-02 12:31 ` Sebastian Andrzej Siewior
2025-05-05 1:43 ` Prakash Sangappa
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=20250502091434.GV4198@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=prakash.sangappa@oracle.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®