<div dir="ltr"><div dir="ltr">On Wed, Jun 22, 2022 at 8:00 AM HAGIO KAZUHITO(萩尾 一仁) <<a href="mailto:k-hagio-ab@nec.com">k-hagio-ab@nec.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Nowadays, some machines have many CPU cores and memory, and some<br>
distributions have a larger kernel.pid_max parameter, e.g. 7 digits.<br>
This impairs the readability of a few commands, especially "ps" and<br>
"ps -l|-m" options.<br>
<br>
Let's extend the field length of the task attributes, PID, CPU, VSZ,<br>
and RSS to improve the readability.<br>
<br></blockquote><div> </div><div>Thank you for the improvement.</div><div>Acked-by: Lianbo Jianb <<a href="mailto:lijiang@redhat.com">lijiang@redhat.com</a>><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Without the patch:<br>
crash> ps<br>
PID PPID CPU TASK ST %MEM VSZ RSS COMM<br>
...<br>
2802197 2699997 2 ffff916f63c40000 IN 0.0 307212 10688 timer<br>
2802277 1 0 ffff9161a25bb080 IN 0.0 169040 2744 gpg-agent<br>
2806711 3167854 10 ffff9167fc498000 IN 0.0 127208 6508 su<br>
2806719 2806711 1 ffff91633c3a48c0 IN 0.0 29452 6416 bash<br>
2988346 1 5 ffff916f7c629840 IN 2.8 9342476 1917384 qemu-kvm<br>
<br>
With the patch:<br>
crash> ps<br>
PID PPID CPU TASK ST %MEM VSZ RSS COMM<br>
...<br>
2802197 2699997 2 ffff916f63c40000 IN 0.0 307212 10688 timer<br>
2802277 1 0 ffff9161a25bb080 IN 0.0 169040 2744 gpg-agent<br>
2806711 3167854 10 ffff9167fc498000 IN 0.0 127208 6508 su<br>
2806719 2806711 1 ffff91633c3a48c0 IN 0.0 29452 6416 bash<br>
2988346 1 5 ffff916f7c629840 IN 2.8 9342476 1917384 qemu-kvm<br>
<br>
Signed-off-by: Kazuhito Hagio <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
---<br>
task.c | 10 +++++-----<br>
1 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/task.c b/task.c<br>
index 864c838637ee..071c787fbfa5 100644<br>
--- a/task.c<br>
+++ b/task.c<br>
@@ -3828,7 +3828,7 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)<br>
} else<br>
fprintf(fp, " ");<br>
<br>
- fprintf(fp, "%5ld %5ld %2s %s %3s",<br>
+ fprintf(fp, "%7ld %7ld %3s %s %3s",<br>
tc->pid, task_to_pid(tc->ptask),<br>
task_cpu(tc->processor, buf2, !VERBOSE),<br>
task_pointer_string(tc, flag & PS_KSTACKP, buf3),<br>
@@ -3838,8 +3838,8 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)<br>
if (strlen(buf1) == 3)<br>
mkstring(buf1, 4, CENTER|RJUST, NULL);<br>
fprintf(fp, "%s ", buf1);<br>
- fprintf(fp, "%7ld ", (tm->total_vm * PAGESIZE())/1024);<br>
- fprintf(fp, "%6ld ", (tm->rss * PAGESIZE())/1024);<br>
+ fprintf(fp, "%8ld ", (tm->total_vm * PAGESIZE())/1024);<br>
+ fprintf(fp, "%8ld ", (tm->rss * PAGESIZE())/1024);<br>
if (is_kernel_thread(tc->task))<br>
fprintf(fp, "[%s]\n", tc->comm);<br>
else<br>
@@ -3856,7 +3856,7 @@ show_ps(ulong flag, struct psinfo *psi)<br>
<br>
if (!(flag & ((PS_EXCLUSIVE & ~PS_ACTIVE)|PS_NO_HEADER)))<br>
fprintf(fp,<br>
- " PID PPID CPU %s ST %%MEM VSZ RSS COMM\n",<br>
+ " PID PPID CPU %s ST %%MEM VSZ RSS COMM\n",<br>
flag & PS_KSTACKP ?<br>
mkstring(buf, VADDR_PRLEN, CENTER|RJUST, "KSTACKP") :<br>
mkstring(buf, VADDR_PRLEN, CENTER, "TASK"));<br>
@@ -7713,7 +7713,7 @@ print_task_header(FILE *out, struct task_context *tc, int newline)<br>
char buf[BUFSIZE];<br>
char buf1[BUFSIZE];<br>
<br>
- fprintf(out, "%sPID: %-5ld TASK: %s CPU: %-2s COMMAND: \"%s\"\n",<br>
+ fprintf(out, "%sPID: %-7ld TASK: %s CPU: %-3s COMMAND: \"%s\"\n",<br>
newline ? "\n" : "", tc->pid,<br>
mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(tc->task)),<br>
task_cpu(tc->processor, buf, !VERBOSE), tc->comm);<br>
-- <br>
2.31.1<br>
</blockquote></div></div>