2024-05-03 10:46:39

by Dietmar Eggemann

[permalink] [raw]
Subject: [PATCH] sched/fair: Add stats update for cfs_rq->exec_clock in update_curr() again

Commit 5d69eca542ee ("sched: Unify runtime accounting across classes")
removed it and since then:

echo 1 > /proc/sys/kernel/sched_schedstats
cat /sys/kernel/debug/sched/debug | grep exec_clock

returns:

.exec_clock : 0.000000

for all cfs_rq's.

Put the schedstat_add() back to be able to watch the cfs_rq runtime
statistic.

Signed-off-by: Dietmar Eggemann <[email protected]>
---
kernel/sched/fair.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9eb63573110c..37bb3cee6fec 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1158,6 +1158,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
delta_exec = update_curr_se(rq_of(cfs_rq), curr);
if (unlikely(delta_exec <= 0))
return;
+ schedstat_add(cfs_rq->exec_clock, delta_exec);

curr->vruntime += calc_delta_fair(delta_exec, curr);
update_deadline(cfs_rq, curr);
--
2.25.1



2024-05-04 12:18:34

by Madadi Vineeth Reddy

[permalink] [raw]
Subject: Re: [PATCH] sched/fair: Add stats update for cfs_rq->exec_clock in update_curr() again

Hi Dietmar Eggemann,

On 03/05/24 16:16, Dietmar Eggemann wrote:
> Commit 5d69eca542ee ("sched: Unify runtime accounting across classes")
> removed it and since then:
>
> echo 1 > /proc/sys/kernel/sched_schedstats
> cat /sys/kernel/debug/sched/debug | grep exec_clock
>
> returns:
>
> .exec_clock : 0.000000
>
> for all cfs_rq's.
>
> Put the schedstat_add() back to be able to watch the cfs_rq runtime
> statistic.
>
> Signed-off-by: Dietmar Eggemann <[email protected]>
> ---
> kernel/sched/fair.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 9eb63573110c..37bb3cee6fec 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1158,6 +1158,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
> delta_exec = update_curr_se(rq_of(cfs_rq), curr);
> if (unlikely(delta_exec <= 0))
> return;
> + schedstat_add(cfs_rq->exec_clock, delta_exec);
>
> curr->vruntime += calc_delta_fair(delta_exec, curr);
> update_deadline(cfs_rq, curr);

Able to see the stats now with the patch.

Tested-by: Madadi Vineeth Reddy <[email protected]>

Thanks and Regards
Madadi Vineeth Reddy