mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/stats: correct the wait_start calculation logic
@ 2025-11-13 12:43 Honglei Wang
  2025-11-26  2:01 ` Honglei Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Honglei Wang @ 2025-11-13 12:43 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid
  Cc: linux-kernel

It's not necessary to do the delta-related subtraction if the task
is not on rq migrating. Add the migrating related judgment back.

Signed-off-by: Honglei Wang <jameshongleiwang@126.com>
---
 kernel/sched/stats.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index d1c9429a4ac5..60560fb31e63 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -12,7 +12,8 @@ void __update_stats_wait_start(struct rq *rq, struct task_struct *p,
 	wait_start = rq_clock(rq);
 	prev_wait_start = schedstat_val(stats->wait_start);
 
-	if (p && likely(wait_start > prev_wait_start))
+	if (p && task_on_rq_migrating(p) &&
+	    likely(wait_start > prev_wait_start))
 		wait_start -= prev_wait_start;
 
 	__schedstat_set(stats->wait_start, wait_start);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched/stats: correct the wait_start calculation logic
  2025-11-13 12:43 [PATCH] sched/stats: correct the wait_start calculation logic Honglei Wang
@ 2025-11-26  2:01 ` Honglei Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Honglei Wang @ 2025-11-26  2:01 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid
  Cc: linux-kernel

Gentle ping on this one submitted a couple of weeks earlier. Is it
worthy of being picked?

Thanks,
Honglei

On 11/13/25 8:43 PM, Honglei Wang wrote:
> It's not necessary to do the delta-related subtraction if the task
> is not on rq migrating. Add the migrating related judgment back.
> 
> Signed-off-by: Honglei Wang <jameshongleiwang@126.com>
> ---
>  kernel/sched/stats.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
> index d1c9429a4ac5..60560fb31e63 100644
> --- a/kernel/sched/stats.c
> +++ b/kernel/sched/stats.c
> @@ -12,7 +12,8 @@ void __update_stats_wait_start(struct rq *rq, struct task_struct *p,
>  	wait_start = rq_clock(rq);
>  	prev_wait_start = schedstat_val(stats->wait_start);
>  
> -	if (p && likely(wait_start > prev_wait_start))
> +	if (p && task_on_rq_migrating(p) &&
> +	    likely(wait_start > prev_wait_start))
>  		wait_start -= prev_wait_start;
>  
>  	__schedstat_set(stats->wait_start, wait_start);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-26  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-13 12:43 [PATCH] sched/stats: correct the wait_start calculation logic Honglei Wang
2025-11-26  2:01 ` Honglei Wang

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®