public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chunxin Zang <spring.cxz@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	vschneid@redhat.com, linux-kernel@vger.kernel.org,
	Chunxin Zang <spring.cxz@gmail.com>
Subject: [PATCH] sched/debug: Correctly print the title fields of runnable tasks
Date: Wed, 13 Mar 2024 09:43:18 +0800	[thread overview]
Message-ID: <20240313014318.1971985-1-spring.cxz@gmail.com> (raw)

The title fields displayed for runnable tasks are now incorrect.
like this:

  runnable tasks:
   S            task   PID         tree-key  switches  prio     wait-time             sum-exec        sum-sleep
  -------------------------------------------------------------------------------------------------------------
   Ikworker/R-rcu_g     4        -1.048576 E        -1.039924         0.750000         0.000000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   Ikworker/R-slub_     5        -1.048576 E        -1.039924         0.750000         0.000000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   Ikworker/R-netns     6        -1.048576 E        -1.039924         0.750000         0.000000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   I   kworker/0:0H     8       194.270371 E       194.304864         3.000000         0.016500         4   100         0.000000         0.016500         0.000000         0.000000 0 0 /
   I    kworker/0:1     9     40954.080088 E     40957.028485         3.000000       132.979107      1516   120         0.000000       132.979107         0.000000         0.000000 0 0 /
   Ikworker/R-mm_pe    11        -1.048576 E        -1.039924         0.750000         0.000000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   Ircu_tasks_kthre    12        -1.048576 E         0.298576         0.750000         0.000000         2   120         0.000000         0.000000         0.000000         0.000000 0 0 /

The display information after fixing is as follows:

  runnable tasks:
   S            task   PID         tree-key E         deadline            slice  switches  prio        wait-time         sum-exec        sum-sleep        sum-block
  -----------------------------------------------------------------------------------------------------------------------------------------------------------------
   S pool_workqueue_     3       115.900753 E       118.861289         3.000000         3   120         0.000000         0.039464         0.000000         0.000000 0 0 /
   I kworker/R-rcu_g     4        -1.048576 E        -1.039924         0.750000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   I kworker/R-slub_     5        -1.048576 E        -1.039924         0.750000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   I kworker/R-netns     6        -1.048576 E        -1.039924         0.750000         2   100         0.000000         0.000000         0.000000         0.000000 0 0 /
   I     kworker/0:0     7       391.218398 E       394.210989         3.000000         5   120         0.000000         0.016042         0.000000         0.000000 0 0 /

Signed-off-by: Chunxin Zang <spring.cxz@gmail.com>
---
 kernel/sched/debug.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 8d5d98a5834d..5359e724d270 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -575,17 +575,16 @@ static void
 print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
 {
 	if (task_current(rq, p))
-		SEQ_printf(m, ">R");
+		SEQ_printf(m, ">R ");
 	else
-		SEQ_printf(m, " %c", task_state_to_char(p));
+		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 %9lld.%06ld %c %9lld.%06ld %9lld.%06ld %9lld %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);
 
@@ -611,10 +610,12 @@ 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 %15s %5s %16s %c %16s %16s %9s %5s %16s %16s %16s %16s\n",
+		   "task", "PID", "tree-key", 'E', "deadline", "slice",
+		   "switches", "prio", "wait-time", "sum-exec", "sum-sleep", "sum-block");
+	SEQ_printf(m, "---------------------------------------------------------------"
+		   "------------------------------------------------------------------"
+		   "--------------------------------\n");
 
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
-- 
2.34.1


                 reply	other threads:[~2024-03-13  1:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240313014318.1971985-1-spring.cxz@gmail.com \
    --to=spring.cxz@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox