]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched,freezer: Mark TASK_FROZEN special
authorPeter Zijlstra <peterz@infradead.org>
Mon, 1 Jul 2024 19:30:09 +0000 (21:30 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Sat, 17 Aug 2024 09:06:44 +0000 (11:06 +0200)
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) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Tested-by: Valentin Schneider <vschneid@redhat.com>
Link: https://lkml.kernel.org/r/20240727105029.998329901@infradead.org
include/linux/sched.h
kernel/freezer.c

index f4a648e739e1272610adba87f4a83c5e886fc8ee..8a3a389bd6232cd00959495e64282bae043ccc3b 100644 (file)
@@ -149,8 +149,9 @@ struct user_event_mm;
  * Special states are those that do not use the normal wait-loop pattern. See
  * the comment with set_special_state().
  */
-#define is_special_task_state(state)                           \
-       ((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | TASK_DEAD))
+#define is_special_task_state(state)                                   \
+       ((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED |      \
+                   TASK_DEAD | TASK_FROZEN))
 
 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
 # define debug_normal_state_change(state_value)                                \
index f57aaf96b8291cfea5c9e7174e011df6463a926a..44bbd7dbd2c87836a360d3791f848ef4d6a0dc7a 100644 (file)
@@ -72,7 +72,7 @@ bool __refrigerator(bool check_kthr_stop)
                bool freeze;
 
                raw_spin_lock_irq(&current->pi_lock);
-               set_current_state(TASK_FROZEN);
+               WRITE_ONCE(current->__state, TASK_FROZEN);
                /* unstale saved_state so that __thaw_task() will wake us up */
                current->saved_state = TASK_RUNNING;
                raw_spin_unlock_irq(&current->pi_lock);