aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/array.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2017-09-22 12:30:40 -0400
committerIngo Molnar <mingo@kernel.org>2017-09-29 05:02:56 -0400
commit06eb61844d841d0032a9950ce7f8e783ee49c0d0 (patch)
tree2c1db5ade5acc687e67f37d69e711bf0470df532 /fs/proc/array.c
parent5f6ad26ea353fdf3dad2328052cbee49e0b9c5b4 (diff)
sched/debug: Add explicit TASK_IDLE printing
Markus reported that kthreads that idle using TASK_IDLE instead of TASK_INTERRUPTIBLE are reported in as TASK_UNINTERRUPTIBLE and things like htop mark those red. This is undesirable, so add an explicit state for TASK_IDLE. Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 01196d3ad452..a120a4549d48 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -119,18 +119,23 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
119 * simple bit tests. 119 * simple bit tests.
120 */ 120 */
121static const char * const task_state_array[] = { 121static const char * const task_state_array[] = {
122 "R (running)", /* 0 */ 122
123 "S (sleeping)", /* 1 */ 123 /* states in TASK_REPORT: */
124 "D (disk sleep)", /* 2 */ 124 "R (running)", /* 0x00 */
125 "T (stopped)", /* 4 */ 125 "S (sleeping)", /* 0x01 */
126 "t (tracing stop)", /* 8 */ 126 "D (disk sleep)", /* 0x02 */
127 "X (dead)", /* 16 */ 127 "T (stopped)", /* 0x04 */
128 "Z (zombie)", /* 32 */ 128 "t (tracing stop)", /* 0x08 */
129 "X (dead)", /* 0x10 */
130 "Z (zombie)", /* 0x20 */
131
132 /* states beyond TASK_REPORT: */
133 "I (idle)", /* 0x40 */
129}; 134};
130 135
131static inline const char *get_task_state(struct task_struct *tsk) 136static inline const char *get_task_state(struct task_struct *tsk)
132{ 137{
133 BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array) - 1); 138 BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != ARRAY_SIZE(task_state_array));
134 return task_state_array[__get_task_state(tsk)]; 139 return task_state_array[__get_task_state(tsk)];
135} 140}
136 141