: Fixes to make /proc/sched_debug better
cover : Fixes to make /proc/sched_debug better
Current /proc/sched_debug can be improved by
- Improving the format of runnable tasks when CONFIG_SCHEDSTATS is not enabled.
- Adding sum_exec info even when CONFIG_SCHEDSTATS is not enabled.
- Removing duplicate information from runnable tasks.
- Adding wait-time info.
Further we could collect sum_sleep_time in /proc/<pid>/schedstat.
Current /proc/sched_debug when CONFIG_SCHEDSTATS is not enabled
runnable tasks:
task PID tree-key switches prio exec-runtime sum-exec sum-sleep
----------------------------------------------------------------------------------------------------------
watchdog/31 223 -11.998676 211 0 0 0 0.000000 0.000000 0.000000 0 /
migration/31 224 0.000000 140 0 0 0 0.000000 0.000000 0.000000 0 /
ksoftirqd/31 225 -13.047772 3 120 0 0 0.000000 0.000000 0.000000 0 /
kworker/31:0H 227 3377.042323 9 100 0 0 0.000000 0.000000 0.000000 0 /
kworker/31:1 286 3306.213547 146 120 0 0 0.000000 0.000000 0.000000 0 /
kworker/u129:3 1476 3250.397029 2 100 0 0 0.000000 0.000000 0.000000 0 /
systemd-logind 1548 0.110774 182 120 0 0 0.000000 0.000000 0.000000 0 /autogroup-60
rtas_errd 1577 0.634662 3 120 0 0 0.000000 0.000000 0.000000 0 /autogroup-66
kworker/31:2 1646 10684.860325 110 120 0 0 0.000000 0.000000 0.000000 0 /
kworker/31:1H 1796 9096.988236 9 100 0 0 0.000000 0.000000 0.000000 0 /Same after this patchset:
runnable tasks:
task PID tree-key switches prio wait-time sum-exec sum-sleep
----------------------------------------------------------------------------------------------------------
watchdog/31 223 -11.998592 60 0 0.000000 0.944690 0.000000 0 /
migration/31 224 0.000000 161 0 0.000000 0.960574 0.000000 0 /
ksoftirqd/31 225 4907.154938 4 120 0.000000 0.005390 0.000000 0 /
kworker/31:0 226 31.071368 15 120 0.000000 0.089008 0.000000 0 /
kworker/31:0H 227 13566.695695 12 100 0.000000 0.080894 0.000000 0 /
kworker/31:1 467 13596.403449 316 120 0.000000 2.314132 0.000000 0 /
auditd 1513 0.256353 992 116 0.000000 20.936048 0.000000 0 /autogroup-46
kworker/31:1H 1804 13566.698706 10 100 0.000000 0.160330 0.000000 0 /
kworker/31:2H 14303 13589.006998 8 100 0.000000 0.085060 0.000000 0 /Current /proc/sched_debug when CONFIG_SCHEDSTATS is set
runnable tasks:
task PID tree-key switches prio exec-runtime sum-exec sum-sleep
----------------------------------------------------------------------------------------------------------
watchdog/159 805 -11.997308 68929 0 -11.997308 386.355640 0.001442 17 / migration/159 806 0.000000 5 0 0.000000 0.541712 0.001364 17 / ksoftirqd/159 807 -13.046724 3 120 -13.046724 0.003454 0.001356 17 / kworker/159:0 808 -6.686082 42 120 -6.686082 2.364758 831990.032194 17 / kworker/159:0H 809 -1.048310 4 100 -1.048310 0.024540 394.824356 17 /
kworker/159:1 6939 14.392296 836 120 14.392296 15.468298 273966793.171550 17 /
Same after this patchset:
runnable tasks:
task PID tree-key switches prio wait-time sum-exec sum-sleep
----------------------------------------------------------------------------------------------------------
watchdog/31 223 -11.998730 29 0 0.016660 0.277190 0.001028 0 /
migration/31 224 0.000000 163 0 0.000530 1.089348 0.000994 0 /
ksoftirqd/31 225 -13.047768 3 120 0.014756 0.001952 0.001164 0 /
kworker/31:0 226 209.731324 17 120 0.755458 0.096596 17888.805854 0 /
kworker/31:0H 227 5556.434079 9 100 0.015650 0.083778 34507.103450 0 /
kworker/31:1 465 223.834529 21 120 0.012962 0.163522 17495.280072 0 /
kworker/31:2 712 10136.506903 158 120 5.358470 2.269444 81162.182416 0 /
kworker/31:1H 5904 10047.528224 6 100 0.028400 0.207288 20745.582406 0 /Srikar Dronamraju (3):
sched:Properly format runnable tasks in /proc/sched_debug sched:Replace vruntime with wait_sum in /proc/sched_debug sched:Add sum_sleep_runtime to /proc/<pid>/sched
kernel/sched/debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 sched:Properly format runnable tasks in /proc/sched_debug
With !CONFIG_SCHEDSTATS, runnable tasks in /proc/sched_debug has too many columns than required. Fix this by printing appropriate columns.
While at this, print sum_exec_runtime, since this information is available even in !CONFIG_SCHEDSTATS case.
--- kernel/sched/debug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/debug.c +4 -2
@@ -136,8 +136,10 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)SPLIT_NS (p->se.sum_exec_runtime), SPLIT_NS(p->se.statistics.sum_sleep_runtime));#else -SEQ_printf (m,"%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld" , -0LL ,0LL ,0LL ,0L ,0LL ,0L ,0LL ,0L ); +SEQ_printf (m,"%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld" , +0LL ,0L , +SPLIT_NS (p->se.sum_exec_runtime), +0LL ,0L );#endif #ifdef CONFIG_NUMA_BALANCING SEQ_printf (m," %d" ,task_node (p));
Signature · 1 line
1.8.3.1
PATCH 2/3 sched:Replace vruntime with wait_sum in /proc/sched_debug
In reply to Srikar DronamrajuWithin runnable tasks in /proc/sched_debug, vruntime is printed twice, once as tree-key and again as exec-runtime.
Since exec-runtime isnt populated in !CONFIG_SCHEDSTATS, use this field to print wait_sum.
--- kernel/sched/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/debug.c +2 -2
@@ -132,7 +132,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) p->prio);#ifdef CONFIG_SCHEDSTATS SEQ_printf (m,"%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld" , -SPLIT_NS (p->se.vruntime), +SPLIT_NS (p->se.statistics.wait_sum),SPLIT_NS (p->se.sum_exec_runtime),SPLIT_NS (p->se.statistics.sum_sleep_runtime));#else
@@ -158,7 +158,7 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)SEQ_printf (m,"\nrunnable tasks:\n" " task PID tree-key switches prio" -" exec-runtime sum-exec sum-sleep\n" +" wait-time sum-exec sum-sleep\n" "------------------------------------------------------" "----------------------------------------------------\n" );
Signature · 1 line
1.8.3.1
PATCH 3/3 sched:Add sum_sleep_runtime to /proc/<pid>/sched
In reply to Srikar DronamrajuWhen CONFIG_SCHEDSTATS is enabled, /proc/<pid>/sched prints almost all sched statistics except sum_sleep_runtime. Since sum_sleep_runtime is a good info to collect, add this it to /proc/<pid>/sched.
--- kernel/sched/debug.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/debug.c +1 -0
@@ -584,6 +584,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) nr_switches = p->nvcsw + p->nivcsw;#ifdef CONFIG_SCHEDSTATS +PN (se.statistics.sum_sleep_runtime);PN (se.statistics.wait_start);PN (se.statistics.sleep_start);PN (se.statistics.block_start);
Signature · 1 line
1.8.3.1
Peter Zijlstra
maintainerQuoted 5 lines · Srikar Dronamraju
Srikar Dronamraju (3):
sched:Properly format runnable tasks in/proc/sched_debugsched:Replace vruntime withwait_sumin/proc/sched_debugsched:Addsum_sleep_runtimeto /proc/<pid>/sched
All patches are lacking a Signed-off-by, can't do anything with them.
Quoted 9 lines · Peter Zijlstra
Quoted 5 lines · Srikar Dronamraju
Srikar Dronamraju (3):
sched:Properly format runnable tasks in/proc/sched_debugsched:Replace vruntime withwait_sumin/proc/sched_debugsched:Addsum_sleep_runtimeto /proc/<pid>/schedAll patches are lacking a Signed-off-by, can't do anything with them.
Sorry about this. I am resending this again.
Thanks for bringing this up.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju