Re: [PATCH v3 0/7] sched: support schedstats for RT sched class

From: Peter Zijlstra
Date: Tue Aug 31 2021 - 06:08:48 EST


On Tue, Aug 24, 2021 at 11:29:39AM +0000, Yafang Shao wrote:
> Hi Ingo, Peter,
>
> This feature is useful to trace the sched details of RT tasks. Hopefully
> you can give some feedback on it.
>
> We want to measure the latency of RT tasks in our production
> environment with schedstats facility, but currently schedstats is only
> supported for fair sched class. In order to support if for other sched
> classes, we should make it independent of fair sched class. The struct
> sched_statistics is the schedular statistics of a task_struct or a
> task_group, both of which are independent of sched class. So we can move
> struct sched_statistics into struct task_struct and struct task_group to
> achieve the goal.

Do you really want schedstats or do you want the tracepoints? In general
I really want to cut back on the built-in statistics crud we carry,
there's too much and it seems to keep growing forever :-(

(as is the case here, you're extending it as well)

That said; making schedstats cover the other classes can be seen as
fixing an inconsistency, but then you forgot deadline.

> After the patchset, schestats are orgnized as follows,
> struct task_struct {
> ...
> struct sched_statistics statistics;
> ...
> struct sched_entity *se;
> struct sched_rt_entity *rt;
> ...
> };
>
> struct task_group { |---> stats[0] : of CPU0
> ... |
> struct sched_statistics **stats; --|---> stats[1] : of CPU1
> ... |
> |---> stats[n] : of CPUn
> #ifdef CONFIG_FAIR_GROUP_SCHED
> struct sched_entity **se;
> #endif
> #ifdef CONFIG_RT_GROUP_SCHED
> struct sched_rt_entity **rt_se;
> #endif
> ...
> };

Yeah, this seems to give a terrible mess, let me see if I can come up
with anything less horrible.