[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALOAHbDXWNbxeQEOhGW5m6bd3cLW_jnE2q6XgSpRBHzxt1GOeg@mail.gmail.com>
Date: Fri, 22 Dec 2023 16:16:37 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: Junwen Wu <wudaemon@....com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com, rostedt@...dmis.org,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched/rt: Fix rt task's sched latency statistics error
in sched_stat_wait trace_point
On Thu, Dec 21, 2023 at 11:03 PM Junwen Wu <wudaemon@....com> wrote:
>
> When enable sched_stat_wait trace_point, some rt tasks sched latency
> so long, like this:
> sched_stat_wait: comm=rcu_preempt pid=14 delay=4936139545261 [ns]
> Rt task has low latency, it must have a bug. When rt task balance off
> source cpu, dequeue operation not update the sched_statistics, so follow
> update_stats_wait_end_fair update method.
>
> Signed-off-by: Junwen Wu <wudaemon@....com>
> ---
> Changes since v1:
> https://lore.kernel.org/all/20231218150322.788382-1-wudaemon@163.com/
>
> kernel/sched/rt.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 6aaf0a3d6081..6a2600213991 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1360,12 +1360,19 @@ update_stats_dequeue_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se,
> int flags)
> {
> struct task_struct *p = NULL;
> + struct rq *rq = rq_of_rt_se(rt_se);
>
> if (!schedstat_enabled())
> return;
>
> if (rt_entity_is_task(rt_se))
> p = rt_task_of(rt_se);
> + /*
> + * Mark the end of the wait period
> + * if dequeueing a waiting task.
> + */
> + if (p && (p != rq->curr))
> + update_stats_wait_end_rt(rt_rq, rt_se);
It seems DL has the same issue. Pls. also fix it in update_stats_dequeue_dl().
And add the Fixes tag in the commit log:
Fixes: 57a5c2dafca8 ("sched/rt: Support schedstats for RT sched class")
Fixes: b5eb4a5f6521 ("sched/dl: Support schedstats for deadline sched class")
>
> if ((flags & DEQUEUE_SLEEP) && p) {
> unsigned int state;
> --
> 2.34.1
>
--
Regards
Yafang
Powered by blists - more mailing lists