mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
sched: Assert task state bits at build time
Since everybody is lazy and prone to forgetting things, make the compiler help us a bit. Signed-off-by: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
464763cf1c
commit
e1781538cf
2 changed files with 14 additions and 8 deletions
|
|
@ -134,14 +134,14 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
|
|||
* simple bit tests.
|
||||
*/
|
||||
static const char *task_state_array[] = {
|
||||
"R (running)", /* 0 */
|
||||
"S (sleeping)", /* 1 */
|
||||
"D (disk sleep)", /* 2 */
|
||||
"T (stopped)", /* 4 */
|
||||
"t (tracing stop)", /* 8 */
|
||||
"Z (zombie)", /* 16 */
|
||||
"X (dead)", /* 32 */
|
||||
"x (dead)", /* 64 */
|
||||
"R (running)", /* 0 */
|
||||
"S (sleeping)", /* 1 */
|
||||
"D (disk sleep)", /* 2 */
|
||||
"T (stopped)", /* 4 */
|
||||
"t (tracing stop)", /* 8 */
|
||||
"Z (zombie)", /* 16 */
|
||||
"X (dead)", /* 32 */
|
||||
"x (dead)", /* 64 */
|
||||
"K (wakekill)", /* 128 */
|
||||
"W (waking)", /* 256 */
|
||||
};
|
||||
|
|
@ -151,6 +151,8 @@ static inline const char *get_task_state(struct task_struct *tsk)
|
|||
unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state;
|
||||
const char **p = &task_state_array[0];
|
||||
|
||||
BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array));
|
||||
|
||||
while (state) {
|
||||
p++;
|
||||
state >>= 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue