Skip to contentSkip to conversation

sched/debug: Update print_task format in sched_debug node

PATCH New Junwen Wu 1 participant 1 message Dec 17, 2023 Scheduler

lore
Share & tools
lore

Junwen Wu

author
#0 lore raw

PATCH v2 1/1 sched/debug: Update print_task format in sched_debug node

For the sched_debug interface, print_task function has output sum_exec_runtime twice, and the promt message not align with the output, so optimize the output.

---

V1 -> V2: fix compile error

 kernel/sched/debug.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
kernel/sched/debug.c +16 -9
index 4580a450700e..342a2a942d51 100644
@@ -579,13 +579,12 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
 	else
 		SEQ_printf(m, " %c", task_state_to_char(p));
 
-	SEQ_printf(m, "%15s %5d %9Ld.%06ld %c %9Ld.%06ld %9Ld.%06ld %9Ld.%06ld %9Ld %5d ",
+	SEQ_printf(m, "%15s %5d %9Ld.%06ld %c %9Ld.%06ld %9Ld.%06ld %9Ld %5d ",
 		p->comm, task_pid_nr(p),
 		SPLIT_NS(p->se.vruntime),
 		entity_eligible(cfs_rq_of(&p->se), &p->se) ? 'E' : 'N',
 		SPLIT_NS(p->se.deadline),
 		SPLIT_NS(p->se.slice),
-		SPLIT_NS(p->se.sum_exec_runtime),
 		(long long)(p->nvcsw + p->nivcsw),
 		p->prio);
 
@@ -596,10 +595,10 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
 		SPLIT_NS(schedstat_val_or_zero(p->stats.sum_block_runtime)));
 
 #ifdef CONFIG_NUMA_BALANCING
-	SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
+	SEQ_printf(m, "   %d   %d", task_node(p), task_numa_group_id(p));
 #endif
 #ifdef CONFIG_CGROUP_SCHED
-	SEQ_printf_task_group_path(m, task_group(p), " %s")
+	SEQ_printf_task_group_path(m, task_group(p), "   %s")
 #endif
 
 	SEQ_printf(m, "\n");
@@ -611,11 +610,19 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
 
 	SEQ_printf(m, "\n");
 	SEQ_printf(m, "runnable tasks:\n");
-	SEQ_printf(m, " S            task   PID         tree-key  switches  prio"
-		   "     wait-time             sum-exec        sum-sleep\n");
-	SEQ_printf(m, "-------------------------------------------------------"
-		   "------------------------------------------------------\n");
-
+	SEQ_printf(m, " S            task   PID         tree-key          deadline"
+		"            slice  switches   prio"
+		"       wait-time         sum-exec        sum-sleep        sum-block"
+#ifdef CONFIG_NUMA_BALANCING
+		"  node_id"
+#endif
+#ifdef CONFIG_CGROUP_SCHED
+		"  group\n"
+#endif
+	);
+	SEQ_printf(m, "-----------------------------------------------------------------"
+			"--------------------------------------------------------------------"
+			"------------------------------------------\n");
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
 		if (task_cpu(p) != rq_cpu)
Signature · 1 line
2.34.1