Blame SOURCES/0002-Extend-field-length-of-task-attributes.patch

acf3ec
From 6bc60e8cc87701c8f68c1cda56dd7120b5565700 Mon Sep 17 00:00:00 2001
acf3ec
From: Kazuhito Hagio <k-hagio-ab@nec.com>
acf3ec
Date: Wed, 22 Jun 2022 08:32:59 +0900
acf3ec
Subject: [PATCH 02/28] Extend field length of task attributes
acf3ec
acf3ec
Nowadays, some machines have many CPU cores and memory, and some
acf3ec
distributions have a larger kernel.pid_max parameter, e.g. 7 digits.
acf3ec
This impairs the readability of a few commands, especially "ps" and
acf3ec
"ps -l|-m" options.
acf3ec
acf3ec
Let's extend the field length of the task attributes, PID, CPU, VSZ,
acf3ec
and RSS to improve the readability.
acf3ec
acf3ec
Without the patch:
acf3ec
  crash> ps
acf3ec
     PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
acf3ec
  ...
acf3ec
    2802197  2699997   2  ffff916f63c40000  IN   0.0  307212  10688  timer
acf3ec
    2802277      1   0  ffff9161a25bb080  IN   0.0  169040   2744  gpg-agent
acf3ec
    2806711  3167854  10  ffff9167fc498000  IN   0.0  127208   6508  su
acf3ec
    2806719  2806711   1  ffff91633c3a48c0  IN   0.0   29452   6416  bash
acf3ec
    2988346      1   5  ffff916f7c629840  IN   2.8 9342476 1917384  qemu-kvm
acf3ec
acf3ec
With the patch:
acf3ec
  crash> ps
acf3ec
        PID    PPID  CPU       TASK        ST  %MEM      VSZ      RSS  COMM
acf3ec
  ...
acf3ec
    2802197 2699997   2  ffff916f63c40000  IN   0.0   307212    10688  timer
acf3ec
    2802277       1   0  ffff9161a25bb080  IN   0.0   169040     2744  gpg-agent
acf3ec
    2806711 3167854  10  ffff9167fc498000  IN   0.0   127208     6508  su
acf3ec
    2806719 2806711   1  ffff91633c3a48c0  IN   0.0    29452     6416  bash
acf3ec
    2988346       1   5  ffff916f7c629840  IN   2.8  9342476  1917384  qemu-kvm
acf3ec
acf3ec
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
acf3ec
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
acf3ec
---
acf3ec
 task.c | 10 +++++-----
acf3ec
 1 file changed, 5 insertions(+), 5 deletions(-)
acf3ec
acf3ec
diff --git a/task.c b/task.c
acf3ec
index 864c838637ee..071c787fbfa5 100644
acf3ec
--- a/task.c
acf3ec
+++ b/task.c
acf3ec
@@ -3828,7 +3828,7 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
acf3ec
 	} else
acf3ec
 		fprintf(fp, "  ");
acf3ec
 
acf3ec
-	fprintf(fp, "%5ld  %5ld  %2s  %s %3s",
acf3ec
+	fprintf(fp, "%7ld %7ld %3s  %s %3s",
acf3ec
 		tc->pid, task_to_pid(tc->ptask),
acf3ec
 		task_cpu(tc->processor, buf2, !VERBOSE),
acf3ec
 		task_pointer_string(tc, flag & PS_KSTACKP, buf3),
acf3ec
@@ -3838,8 +3838,8 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
acf3ec
 	if (strlen(buf1) == 3)
acf3ec
 		mkstring(buf1, 4, CENTER|RJUST, NULL);
acf3ec
 	fprintf(fp, "%s ", buf1);
acf3ec
-	fprintf(fp, "%7ld ", (tm->total_vm * PAGESIZE())/1024);
acf3ec
-	fprintf(fp, "%6ld  ", (tm->rss * PAGESIZE())/1024);
acf3ec
+	fprintf(fp, "%8ld ", (tm->total_vm * PAGESIZE())/1024);
acf3ec
+	fprintf(fp, "%8ld  ", (tm->rss * PAGESIZE())/1024);
acf3ec
 	if (is_kernel_thread(tc->task))
acf3ec
 		fprintf(fp, "[%s]\n", tc->comm);
acf3ec
 	else
acf3ec
@@ -3856,7 +3856,7 @@ show_ps(ulong flag, struct psinfo *psi)
acf3ec
 
acf3ec
 	if (!(flag & ((PS_EXCLUSIVE & ~PS_ACTIVE)|PS_NO_HEADER))) 
acf3ec
 		fprintf(fp, 
acf3ec
-		    "   PID    PPID  CPU %s  ST  %%MEM     VSZ    RSS  COMM\n",
acf3ec
+		    "      PID    PPID  CPU %s  ST  %%MEM      VSZ      RSS  COMM\n",
acf3ec
 			flag & PS_KSTACKP ?
acf3ec
 			mkstring(buf, VADDR_PRLEN, CENTER|RJUST, "KSTACKP") :
acf3ec
 			mkstring(buf, VADDR_PRLEN, CENTER, "TASK"));
acf3ec
@@ -7713,7 +7713,7 @@ print_task_header(FILE *out, struct task_context *tc, int newline)
acf3ec
 	char buf[BUFSIZE];
acf3ec
 	char buf1[BUFSIZE];
acf3ec
 
acf3ec
-        fprintf(out, "%sPID: %-5ld  TASK: %s  CPU: %-2s  COMMAND: \"%s\"\n",
acf3ec
+        fprintf(out, "%sPID: %-7ld  TASK: %s  CPU: %-3s  COMMAND: \"%s\"\n",
acf3ec
 		newline ? "\n" : "", tc->pid, 
acf3ec
 		mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(tc->task)),
acf3ec
 		task_cpu(tc->processor, buf, !VERBOSE), tc->comm);
acf3ec
-- 
acf3ec
2.37.1
acf3ec