Skip to content

Commit a1c4466

Browse files
author
Peter Zijlstra
committed
sched,freezer: Mark TASK_FROZEN special
The special task states are those that do not suffer spurious wakeups, TASK_FROZEN is very much one of those, mark it as such. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Valentin Schneider <[email protected]> Tested-by: Valentin Schneider <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 781773e commit a1c4466

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/linux/sched.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ struct user_event_mm;
149149
* Special states are those that do not use the normal wait-loop pattern. See
150150
* the comment with set_special_state().
151151
*/
152-
#define is_special_task_state(state) \
153-
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | TASK_DEAD))
152+
#define is_special_task_state(state) \
153+
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | \
154+
TASK_DEAD | TASK_FROZEN))
154155

155156
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
156157
# define debug_normal_state_change(state_value) \

kernel/freezer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool __refrigerator(bool check_kthr_stop)
7272
bool freeze;
7373

7474
raw_spin_lock_irq(&current->pi_lock);
75-
set_current_state(TASK_FROZEN);
75+
WRITE_ONCE(current->__state, TASK_FROZEN);
7676
/* unstale saved_state so that __thaw_task() will wake us up */
7777
current->saved_state = TASK_RUNNING;
7878
raw_spin_unlock_irq(&current->pi_lock);

0 commit comments

Comments
 (0)