Re: [PATCH 2/2] sched: add throttled time stat for throttled children

From: Tejun Heo
Date: Tue May 23 2023 - 17:45:21 EST


Hello,

(cc'ing Johannes)

On Wed, May 17, 2023 at 06:34:14PM -0700, Josh Don wrote:
> We currently export the total throttled time for cgroups that are given
> a bandwidth limit. This patch extends this accounting to also account
> the total time that each children cgroup has been throttled.
>
> This is useful to understand the degree to which children have been
> affected by the throttling control. Children which are not runnable
> during the entire throttled period, for example, will not show any
> self-throttling time during this period.
...
> @@ -11204,20 +11217,24 @@ static int cpu_extra_stat_show(struct seq_file *sf,
> {
> struct task_group *tg = css_tg(css);
> struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
> - u64 throttled_usec, burst_usec;
> + u64 throttled_usec, burst_usec, throttled_self_usec;
>
> throttled_usec = cfs_b->throttled_time;
> do_div(throttled_usec, NSEC_PER_USEC);
> + throttled_self_usec = throttled_time_self(tg);
> + do_div(throttled_self_usec, NSEC_PER_USEC);
> burst_usec = cfs_b->burst_time;
> do_div(burst_usec, NSEC_PER_USEC);
>
> seq_printf(sf, "nr_periods %d\n"
> "nr_throttled %d\n"
> "throttled_usec %llu\n"
> + "throttled_self_usec %llu\n"

This is fine in principle but I think it'd be better to keep it consistent
with how non-hierarchical events are in memory.events.local. ie. Can we
please add cpu.stat.local instead of adding the _self key to cpu.stat?

Thanks.

--
tejun