diff options
author | Peter Zijlstra <peterz@infradead.org> | 2017-09-22 12:09:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-09-29 04:09:08 -0400 |
commit | 1593baab910da72480d651ea7bf2ce6e3a25a484 (patch) | |
tree | f25d6f915062f9c322233c987d30a66260f474bb /fs/proc/array.c | |
parent | 770b782f555d663d133fcd4dc1632023f79357b9 (diff) |
sched/debug: Implement consistent task-state printing
Currently get_task_state() and task_state_to_char() report different
states, create a number of common helpers and unify the reported state
space.
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.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 525157ca25cb..01196d3ad452 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -130,19 +130,8 @@ static const char * const task_state_array[] = { | |||
130 | 130 | ||
131 | static inline const char *get_task_state(struct task_struct *tsk) | 131 | static inline const char *get_task_state(struct task_struct *tsk) |
132 | { | 132 | { |
133 | unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; | 133 | BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array) - 1); |
134 | 134 | return task_state_array[__get_task_state(tsk)]; | |
135 | /* | ||
136 | * Parked tasks do not run; they sit in __kthread_parkme(). | ||
137 | * Without this check, we would report them as running, which is | ||
138 | * clearly wrong, so we report them as sleeping instead. | ||
139 | */ | ||
140 | if (tsk->state == TASK_PARKED) | ||
141 | state = TASK_INTERRUPTIBLE; | ||
142 | |||
143 | BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array)-1); | ||
144 | |||
145 | return task_state_array[fls(state)]; | ||
146 | } | 135 | } |
147 | 136 | ||
148 | static inline int get_task_umask(struct task_struct *tsk) | 137 | static inline int get_task_umask(struct task_struct *tsk) |