aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kernel.h2
-rw-r--r--kernel/sched/core.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5449d2f4a1ef..64ce58bee6f5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -176,7 +176,7 @@ extern int _cond_resched(void);
176 */ 176 */
177# define might_sleep() \ 177# define might_sleep() \
178 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) 178 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
179# define sched_annotate_sleep() __set_current_state(TASK_RUNNING) 179# define sched_annotate_sleep() (current->task_state_change = 0)
180#else 180#else
181 static inline void ___might_sleep(const char *file, int line, 181 static inline void ___might_sleep(const char *file, int line,
182 int preempt_offset) { } 182 int preempt_offset) { }
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c0accc00566e..e628cb11b560 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7292,13 +7292,12 @@ void __might_sleep(const char *file, int line, int preempt_offset)
7292 * since we will exit with TASK_RUNNING make sure we enter with it, 7292 * since we will exit with TASK_RUNNING make sure we enter with it,
7293 * otherwise we will destroy state. 7293 * otherwise we will destroy state.
7294 */ 7294 */
7295 if (WARN_ONCE(current->state != TASK_RUNNING, 7295 WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
7296 "do not call blocking ops when !TASK_RUNNING; " 7296 "do not call blocking ops when !TASK_RUNNING; "
7297 "state=%lx set at [<%p>] %pS\n", 7297 "state=%lx set at [<%p>] %pS\n",
7298 current->state, 7298 current->state,
7299 (void *)current->task_state_change, 7299 (void *)current->task_state_change,
7300 (void *)current->task_state_change)) 7300 (void *)current->task_state_change);
7301 __set_current_state(TASK_RUNNING);
7302 7301
7303 ___might_sleep(file, line, preempt_offset); 7302 ___might_sleep(file, line, preempt_offset);
7304} 7303}