Re: [PATCH] tg: add cpu's wait_count of a task group

Tejun Heo
2021-01-19T15:32:25Z

Hello,

On Mon, Jan 18, 2021 at 11:07:47AM +0800, liming wu wrote:
> > > + if (schedstat_enabled() && tg != &root_task_group) {
> > > + u64 ws = 0;
> > > + u64 wc = 0;
> > > + int i;
> > > +
> > > + for_each_possible_cpu(i) {
> > > + ws += schedstat_val(tg->se[i]->statistics.wait_sum);
> > > + wc += schedstat_val(tg->se[i]->statistics.wait_count);
> > > + }
> > > +
> > > + seq_printf(sf, "wait_sum %llu\n"
> > > + "wait_count %llu\n", ws, wc);
> > > + }
> >
> > What does sum/count tell?
> It can tell the task group average latency of every context switch
> wait_sum is equivalent to sched_info->run_delay (the second parameter
> of /proc/$pid/schedstat)
> wait_count is equivalent to sched_info->pcount(the third parameter of
> /proc/$pid/schedstat)

Sounds good to me but can you please:

* Rename wait_sum to wait_usec and make sure the duration is in usecs.

* Rename wait_count to nr_waits.

* This should go through the scheduler tree. When you post the updated
version, please cc the scheduler folks from MAINAINERS.

Thanks.

--
tejun