Revert task flag re-ordering, add comments

Roland points out that the flags end up having non-obvious dependencies
elsewhere, so revert aa55a08687059aa169d10a313c41f238c2070488 and add
some comments about why things are as they are.

We'll just have to fix up the broken comparisons. Roland has a patch.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>

+17 -5
+17 -5
include/linux/sched.h
··· 107 107 108 108 #include <asm/processor.h> 109 109 110 + /* 111 + * Task state bitmask. NOTE! These bits are also 112 + * encoded in fs/proc/array.c: get_task_state(). 113 + * 114 + * We have two separate sets of flags: task->state 115 + * is about runnability, while task->exit_state are 116 + * about the task exiting. Confusing, but this way 117 + * modifying one set can't modify the other one by 118 + * mistake. 119 + */ 110 120 #define TASK_RUNNING 0 111 121 #define TASK_INTERRUPTIBLE 1 112 122 #define TASK_UNINTERRUPTIBLE 2 113 - #define TASK_NONINTERACTIVE 4 114 - #define TASK_STOPPED 8 115 - #define TASK_TRACED 16 116 - #define EXIT_ZOMBIE 32 117 - #define EXIT_DEAD 64 123 + #define TASK_STOPPED 4 124 + #define TASK_TRACED 8 125 + /* in tsk->exit_state */ 126 + #define EXIT_ZOMBIE 16 127 + #define EXIT_DEAD 32 128 + /* in tsk->state again */ 129 + #define TASK_NONINTERACTIVE 64 118 130 119 131 #define __set_task_state(tsk, state_value) \ 120 132 do { (tsk)->state = (state_value); } while (0)