[PATCH v2 23/25] modify print_task_header() to indicate idle task on offline cpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the offline cpu is halt, the active task(idle task) on offline cpu
is not running actually. Add "<OFFLINE>" at the end of task header to
indicate such tasks.

The offline cpu is #2, and the output is changed from:
<cut>
crash> ps -l
...
[             0] [RU]  PID: 0      TASK: ffffffff818d5440  CPU: 0   COMMAND: "swapper/0"
[             0] [RU]  PID: 0      TASK: ffff88003dad4fa0  CPU: 1   COMMAND: "swapper/1"
[             0] [RU]  PID: 0      TASK: ffff88003dad5b00  CPU: 2   COMMAND: "swapper/2"
[             0] [RU]  PID: 0      TASK: ffff88003dad6660  CPU: 3   COMMAND: "swapper/3"
<cut>

to:
<cut>
crash> ps -l
...
[             0] [RU]  PID: 0      TASK: ffffffff818d5440  CPU: 0   COMMAND: "swapper/0"
[             0] [RU]  PID: 0      TASK: ffff88003dad4fa0  CPU: 1   COMMAND: "swapper/1"
[             0] [RU]  PID: 0      TASK: ffff88003dad5b00  CPU: 2   COMMAND: "swapper/2" <OFFLINE>
[             0] [RU]  PID: 0      TASK: ffff88003dad6660  CPU: 3   COMMAND: "swapper/3"
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx>
---
 task.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/task.c b/task.c
index 27c3aa4..2c8c4e4 100755
--- a/task.c
+++ b/task.c
@@ -6609,10 +6609,16 @@ print_task_header(FILE *out, struct task_context *tc, int newline)
 	char buf[BUFSIZE];
 	char buf1[BUFSIZE];
 
-        fprintf(out, "%sPID: %-5ld  TASK: %s  CPU: %-2s  COMMAND: \"%s\"\n",
+	int task_offline;
+
+	task_offline = is_task_active(tc->task) &&
+			check_offline_cpu(tc->processor);
+
+        fprintf(out, "%sPID: %-5ld  TASK: %s  CPU: %-2s  COMMAND: \"%s\" %s\n",
 		newline ? "\n" : "", tc->pid, 
 		mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(tc->task)),
-		task_cpu(tc->processor, buf, !VERBOSE), tc->comm);
+		task_cpu(tc->processor, buf, !VERBOSE), tc->comm,
+		task_offline ? "<OFFLINE>" : "");
 }
 
 /*
-- 
1.8.5.3

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux