tg: add sched wait_count of a task group
PATCH v2 1/1 tg: add sched wait_count of a task group
From: Liming Wu <[email protected]>
Now we can rely on PSI to reflect whether there is contention in the task group, but it cannot reflect the details of the contention. Through this metric, we can get avg latency of task group contention
from the dimension of scheduling.
delta(wait_usec)/delta(nr_waits)
Also change wait_sum to wait_usec.
Signed-off-by Liming Wu <[email protected]>
--- kernel/sched/core.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
kernel/sched/core.c +21 -2
@@ -8146,12 +8146,17 @@ static int cpu_cfs_stat_show(struct seq_file *sf, void *v)if (schedstat_enabled () && tg != &root_task_group) {u64 ws =0 ; +u64 wc =0 ;int i; -for_each_possible_cpu (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" , ws); +do_div (ws,NSEC_PER_USEC ); +seq_printf (sf,"wait_usec %llu\n" +"nr_waits %llu\n" , ws, wc); }return 0 ;
@@ -8255,6 +8260,20 @@ static int cpu_extra_stat_show(struct seq_file *sf,"throttled_usec %llu\n" , cfs_b->nr_periods, cfs_b->nr_throttled, throttled_usec); +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); + } + +do_div (ws,NSEC_PER_USEC ); +seq_printf (sf,"wait_usec %llu\n" +"nr_waits %llu\n" , ws, wc); + } }#endif return 0 ;
Signature · 1 line
2.20.1
A message that is not in the archive (sent off-list or not yet received): 20210121201157.1933-1-wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Your subject is wrong; this is 100% a sched patch.
Quoted 7 lines · On Fri, Jan 22, 2021 at 04:11:57AM +0800…
From: Liming Wu <[email protected]>
Now we can rely on PSI to reflect whether there is contention in the task group, but it cannot reflect the details of the contention. Through this metric, we can get avg latency of task group contention
from the dimension of scheduling.
delta(wait_usec)/delta(nr_waits)
Only if all tasks have the same weight. So in general this is useless.
Quoted 1 line
Also change
wait_sumtowait_usec.
Also patches should do 1 thing, also you can't do that, you'll break everybody that expect the current value.