diff options
-rw-r--r-- | include/linux/kernel.h | 2 | ||||
-rw-r--r-- | kernel/exit.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 3d770f5564b8..5068a0d9fecd 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -175,10 +175,12 @@ extern int _cond_resched(void); | |||
175 | */ | 175 | */ |
176 | # define might_sleep() \ | 176 | # define might_sleep() \ |
177 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) | 177 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) |
178 | # define sched_annotate_sleep() __set_current_state(TASK_RUNNING) | ||
178 | #else | 179 | #else |
179 | static inline void __might_sleep(const char *file, int line, | 180 | static inline void __might_sleep(const char *file, int line, |
180 | int preempt_offset) { } | 181 | int preempt_offset) { } |
181 | # define might_sleep() do { might_resched(); } while (0) | 182 | # define might_sleep() do { might_resched(); } while (0) |
183 | # define sched_annotate_sleep() do { } while (0) | ||
182 | #endif | 184 | #endif |
183 | 185 | ||
184 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) | 186 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) |
diff --git a/kernel/exit.c b/kernel/exit.c index 5d30019ff953..232c4bc8bcc9 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -997,6 +997,8 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) | |||
997 | 997 | ||
998 | get_task_struct(p); | 998 | get_task_struct(p); |
999 | read_unlock(&tasklist_lock); | 999 | read_unlock(&tasklist_lock); |
1000 | sched_annotate_sleep(); | ||
1001 | |||
1000 | if ((exit_code & 0x7f) == 0) { | 1002 | if ((exit_code & 0x7f) == 0) { |
1001 | why = CLD_EXITED; | 1003 | why = CLD_EXITED; |
1002 | status = exit_code >> 8; | 1004 | status = exit_code >> 8; |
@@ -1079,6 +1081,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) | |||
1079 | * thread can reap it because we its state == DEAD/TRACE. | 1081 | * thread can reap it because we its state == DEAD/TRACE. |
1080 | */ | 1082 | */ |
1081 | read_unlock(&tasklist_lock); | 1083 | read_unlock(&tasklist_lock); |
1084 | sched_annotate_sleep(); | ||
1082 | 1085 | ||
1083 | retval = wo->wo_rusage | 1086 | retval = wo->wo_rusage |
1084 | ? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0; | 1087 | ? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0; |
@@ -1210,6 +1213,7 @@ unlock_sig: | |||
1210 | pid = task_pid_vnr(p); | 1213 | pid = task_pid_vnr(p); |
1211 | why = ptrace ? CLD_TRAPPED : CLD_STOPPED; | 1214 | why = ptrace ? CLD_TRAPPED : CLD_STOPPED; |
1212 | read_unlock(&tasklist_lock); | 1215 | read_unlock(&tasklist_lock); |
1216 | sched_annotate_sleep(); | ||
1213 | 1217 | ||
1214 | if (unlikely(wo->wo_flags & WNOWAIT)) | 1218 | if (unlikely(wo->wo_flags & WNOWAIT)) |
1215 | return wait_noreap_copyout(wo, p, pid, uid, why, exit_code); | 1219 | return wait_noreap_copyout(wo, p, pid, uid, why, exit_code); |
@@ -1272,6 +1276,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) | |||
1272 | pid = task_pid_vnr(p); | 1276 | pid = task_pid_vnr(p); |
1273 | get_task_struct(p); | 1277 | get_task_struct(p); |
1274 | read_unlock(&tasklist_lock); | 1278 | read_unlock(&tasklist_lock); |
1279 | sched_annotate_sleep(); | ||
1275 | 1280 | ||
1276 | if (!wo->wo_info) { | 1281 | if (!wo->wo_info) { |
1277 | retval = wo->wo_rusage | 1282 | retval = wo->wo_rusage |