lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240313014318.1971985-1-spring.cxz@gmail.com>
Date: Wed, 13 Mar 2024 09:43:18 +0800
From: Chunxin Zang <spring.cxz@...il.com>
To: mingo@...hat.com,
	peterz@...radead.org,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	bristot@...hat.com,
	vschneid@...hat.com,
	linux-kernel@...r.kernel.org,
	Chunxin Zang <spring.cxz@...il.com>
Subject: [PATCH] sched/debug: Correctly print the title fields of runnable tasks

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@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ