mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: Prakash Sangappa <prakash.sangappa@oracle.com>
Cc: peterz@infradead.org, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, tglx@linutronix.de,
	bigeasy@linutronix.de, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org,
	Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: Re: [PATCH V4 4/6] Sched: Add scheduler stat for cpu time slice extension
Date: Wed, 14 May 2025 18:07:56 +0530	[thread overview]
Message-ID: <d3bb8ecd-3ac2-4025-bd81-4d612bb26995@linux.ibm.com> (raw)
In-Reply-To: <20250513214554.4160454-5-prakash.sangappa@oracle.com>

On 14/05/25 03:15, Prakash Sangappa wrote:
> Add scheduler stat to record number of times the thread was granted
> cpu time slice extension.
> 
> Signed-off-by: Prakash Sangappa <prakash.sangappa@oracle.com>
> ---
>  include/linux/sched.h | 2 ++
>  kernel/rseq.c         | 1 +
>  kernel/sched/core.c   | 5 +++++
>  kernel/sched/debug.c  | 1 +
>  4 files changed, 9 insertions(+)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index c279232ca6a2..8cf756e80ae9 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -340,6 +340,7 @@ extern void io_schedule_finish(int token);
>  extern long io_schedule_timeout(long timeout);
>  extern void io_schedule(void);
>  extern void hrtick_local_start(u64 delay);
> +extern void update_stat_preempt_delayed(struct task_struct *t);
>  
>  /* wrapper function to trace from this header file */
>  DECLARE_TRACEPOINT(sched_set_state_tp);
> @@ -563,6 +564,7 @@ struct sched_statistics {
>  	u64				nr_wakeups_affine_attempts;
>  	u64				nr_wakeups_passive;
>  	u64				nr_wakeups_idle;
> +	u64				nr_preempt_delay_granted;
>  
>  #ifdef CONFIG_SCHED_CORE
>  	u64				core_forceidle_sum;
> diff --git a/kernel/rseq.c b/kernel/rseq.c
> index 44d0f3ae0cd3..c4bc52f8ba9c 100644
> --- a/kernel/rseq.c
> +++ b/kernel/rseq.c
> @@ -475,6 +475,7 @@ bool rseq_delay_resched(void)
>  		return false;
>  
>  	t->sched_time_delay = 1;
> +	update_stat_preempt_delayed(t);
>  
>  	return true;
>  }
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 31928cbcd907..880368756b48 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -938,6 +938,11 @@ void hrtick_local_start(u64 delay)
>  	rq_unlock(rq, &rf);
>  }
>  
> +void update_stat_preempt_delayed(struct task_struct *t)
> +{
> +	schedstat_inc(t->stats.nr_preempt_delay_granted);

I think schedstat documentation also needs to be updated
and may be bump the version number.

Thanks,
Madadi Vineeth Reddy

> +}
> +
>  static void hrtick_rq_init(struct rq *rq)
>  {
>  #ifdef CONFIG_SMP
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index 4cba21f5d24d..6b753f56c312 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -1216,6 +1216,7 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
>  		P_SCHEDSTAT(nr_wakeups_affine_attempts);
>  		P_SCHEDSTAT(nr_wakeups_passive);
>  		P_SCHEDSTAT(nr_wakeups_idle);
> +		P_SCHEDSTAT(nr_preempt_delay_granted);
>  
>  		avg_atom = p->se.sum_exec_runtime;
>  		if (nr_switches)


  reply	other threads:[~2025-05-14 12:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 21:45 [PATCH V4 0/6] Scheduler " Prakash Sangappa
2025-05-13 21:45 ` [PATCH V4 1/6] Sched: " Prakash Sangappa
2025-05-14 10:58   ` Madadi Vineeth Reddy
2025-05-14 23:12     ` Prakash Sangappa
2025-05-15  9:01       ` Steven Rostedt
2025-05-20 16:52         ` Prakash Sangappa
2025-05-20 20:20           ` Steven Rostedt
2025-05-23 20:06   ` Mathieu Desnoyers
2025-05-23 20:34     ` Prakash Sangappa
2025-05-13 21:45 ` [PATCH V4 2/6] Sched: Indicate if thread got rescheduled Prakash Sangappa
2025-05-13 21:45 ` [PATCH V4 3/6] Sched: Tunable to specify duration of time slice extension Prakash Sangappa
2025-05-14 11:21   ` kernel test robot
2025-05-13 21:45 ` [PATCH V4 4/6] Sched: Add scheduler stat for cpu " Prakash Sangappa
2025-05-14 12:37   ` Madadi Vineeth Reddy [this message]
2025-05-14 23:01     ` Prakash Sangappa
2025-05-13 21:45 ` [PATCH V4 5/6] Sched: Add tracepoint for sched " Prakash Sangappa
2025-05-13 21:45 ` [PATCH V4 6/6] Add API to query supported rseq cs flags Prakash Sangappa
2025-05-23 19:57   ` Mathieu Desnoyers
2025-05-23 20:03     ` Prakash Sangappa
2025-05-20 21:01 ` [PATCH V4 0/6] Scheduler time slice extension 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=d3bb8ecd-3ac2-4025-bd81-4d612bb26995@linux.ibm.com \
    --to=vineethr@linux.ibm.com \
    --cc=bigeasy@linutronix.de \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.org \
    --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®