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

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