diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 38c8654aaa96..c3ba31f210a9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -107,13 +107,25 @@ extern unsigned long nr_iowait(void); | |||
107 | 107 | ||
108 | #include <asm/processor.h> | 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 | #define TASK_RUNNING 0 | 120 | #define TASK_RUNNING 0 |
111 | #define TASK_INTERRUPTIBLE 1 | 121 | #define TASK_INTERRUPTIBLE 1 |
112 | #define TASK_UNINTERRUPTIBLE 2 | 122 | #define TASK_UNINTERRUPTIBLE 2 |
113 | #define TASK_STOPPED 4 | 123 | #define TASK_STOPPED 4 |
114 | #define TASK_TRACED 8 | 124 | #define TASK_TRACED 8 |
125 | /* in tsk->exit_state */ | ||
115 | #define EXIT_ZOMBIE 16 | 126 | #define EXIT_ZOMBIE 16 |
116 | #define EXIT_DEAD 32 | 127 | #define EXIT_DEAD 32 |
128 | /* in tsk->state again */ | ||
117 | #define TASK_NONINTERACTIVE 64 | 129 | #define TASK_NONINTERACTIVE 64 |
118 | 130 | ||
119 | #define __set_task_state(tsk, state_value) \ | 131 | #define __set_task_state(tsk, state_value) \ |
@@ -121,6 +133,17 @@ extern unsigned long nr_iowait(void); | |||
121 | #define set_task_state(tsk, state_value) \ | 133 | #define set_task_state(tsk, state_value) \ |
122 | set_mb((tsk)->state, (state_value)) | 134 | set_mb((tsk)->state, (state_value)) |
123 | 135 | ||
136 | /* | ||
137 | * set_current_state() includes a barrier so that the write of current->state | ||
138 | * is correctly serialised wrt the caller's subsequent test of whether to | ||
139 | * actually sleep: | ||
140 | * | ||
141 | * set_current_state(TASK_UNINTERRUPTIBLE); | ||
142 | * if (do_i_need_to_sleep()) | ||
143 | * schedule(); | ||
144 | * | ||
145 | * If the caller does not need such serialisation then use __set_current_state() | ||
146 | */ | ||
124 | #define __set_current_state(state_value) \ | 147 | #define __set_current_state(state_value) \ |
125 | do { current->state = (state_value); } while (0) | 148 | do { current->state = (state_value); } while (0) |
126 | #define set_current_state(state_value) \ | 149 | #define set_current_state(state_value) \ |