diff options
-rw-r--r-- | fs/proc/array.c | 15 | ||||
-rw-r--r-- | include/linux/sched.h | 2 |
2 files changed, 4 insertions, 13 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 1bd2077187fd..554a0b229ac2 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -140,24 +140,15 @@ static const char * const task_state_array[] = { | |||
140 | "t (tracing stop)", /* 8 */ | 140 | "t (tracing stop)", /* 8 */ |
141 | "Z (zombie)", /* 16 */ | 141 | "Z (zombie)", /* 16 */ |
142 | "X (dead)", /* 32 */ | 142 | "X (dead)", /* 32 */ |
143 | "x (dead)", /* 64 */ | ||
144 | "K (wakekill)", /* 128 */ | ||
145 | "W (waking)", /* 256 */ | ||
146 | "P (parked)", /* 512 */ | ||
147 | }; | 143 | }; |
148 | 144 | ||
149 | static inline const char *get_task_state(struct task_struct *tsk) | 145 | static inline const char *get_task_state(struct task_struct *tsk) |
150 | { | 146 | { |
151 | unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; | 147 | unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; |
152 | const char * const *p = &task_state_array[0]; | ||
153 | 148 | ||
154 | BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array)); | 149 | BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array)-1); |
155 | 150 | ||
156 | while (state) { | 151 | return task_state_array[fls(state)]; |
157 | p++; | ||
158 | state >>= 1; | ||
159 | } | ||
160 | return *p; | ||
161 | } | 152 | } |
162 | 153 | ||
163 | static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | 154 | static inline void task_state(struct seq_file *m, struct pid_namespace *ns, |
diff --git a/include/linux/sched.h b/include/linux/sched.h index cf9e414dbb9e..33e4e9e1f621 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -229,7 +229,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
229 | /* get_task_state() */ | 229 | /* get_task_state() */ |
230 | #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ | 230 | #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ |
231 | TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ | 231 | TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ |
232 | __TASK_TRACED) | 232 | __TASK_TRACED | EXIT_ZOMBIE | EXIT_DEAD) |
233 | 233 | ||
234 | #define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) | 234 | #define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) |
235 | #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) | 235 | #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) |