All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH V2] tg: add sched wait_count of a task group
       [not found] ` <20210121201157.1933-1-wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2021-01-21 13:40   ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2021-01-21 13:40 UTC (permalink / raw)
  To: wu860403-Re5JQEeQqe8AvxtiuMwx3w
  Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA,
	mingo-H+wXaHxf7aLQT0dZR+AlfA, 398776277-9uewiaClKEY


Your subject is wrong; this is 100% a sched patch.

On Fri, Jan 22, 2021 at 04:11:57AM +0800, wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> From: Liming Wu <wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> 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.

> Also change wait_sum to wait_usec.

Also patches should do 1 thing, also you can't do that, you'll break
everybody that expect the current value.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH V2] tg: add sched wait_count of a task group
@ 2021-01-21 20:11 wu860403-Re5JQEeQqe8AvxtiuMwx3w
       [not found] ` <20210121201157.1933-1-wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: wu860403-Re5JQEeQqe8AvxtiuMwx3w @ 2021-01-21 20:11 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA
  Cc: mingo-H+wXaHxf7aLQT0dZR+AlfA, peterz-wEGCiKHe2LqWVfeAwA7xHQ,
	398776277-9uewiaClKEY, Liming Wu

From: Liming Wu <wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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 <wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 kernel/sched/core.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e7e453492..45e46114e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-21 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 20:11 [PATCH V2] tg: add sched wait_count of a task group wu860403-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <20210121201157.1933-1-wu860403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-01-21 13:40   ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.