kernel commit 06eb61844d ("sched/debug: Add explicit TASK_IDLE
printing") exposed the TASK_IDLE task state to user space as
'I (idle)' state.
$ cat /proc/4/status
Name: kworker/0:0H
Umask: 0000
State: I (idle)
$ ps 4
PID TTY STAT TIME COMMAND
4 ? I< 0:00 [kworker/0:0H]
On the other hand, crash still shows 'UN' for TASK_IDLE state.
crash> ps 4
PID PPID CPU TASK ST %MEM VSZ RSS COMM
4 2 0 ffff8d1dbe884200 UN 0.0 0 0 [kworker/0:0H]
crash> ps -S
RU: 3
IN: 69
UN: 53
It is confusing for support folks, and 'foreach UN bt', which shows
useful information for troubles like system stall, includes unexpected
idle tasks. So let's print TASK_IDLE as 'ID' state. [Patch 2]
However, since Linux 4.14, kernel commit 20435d84e5 ("sched/debug:
Intruduce task_state_to_char() helper function") removed the 'stat_nam'
symbol, with which we've got the values of task state bitmasks. So
now we need to get them correctly by using 'task_state_array' again.
[Patch 1]
Additionally, kernel commit 7dc603c902 ("sched/fair: Fix PELT integrity
for new tasks") introduced TASK_NEW state. [Patch 3] adds support for
it as 'NE' state.
Kazuhito Hagio (3):
Fix task state bitmasks for 4.14 and later
Add support for TASK_IDLE task state
Add support for TASK_NEW task state
help.c | 4 ++--
task.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 54 insertions(+), 4 deletions(-)
--
1.8.3.1