sched/wakeup: Split out the wakeup ->__state check
authorThomas Gleixner <tglx@linutronix.de>
Sun, 15 Aug 2021 21:27:40 +0000 (23:27 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 17 Aug 2021 14:40:54 +0000 (16:40 +0200)
commit43295d73adc8d3780e9f34206663e336678aaff8
tree5f473e7d8e352b43a9d7d3acec562a2a8d800448
parentb41cda03765580caf7723b8c1b672d191c71013f
sched/wakeup: Split out the wakeup ->__state check

RT kernels have a slightly more complicated handling of wakeups due to
'sleeping' spin/rwlocks. If a task is blocked on such a lock then the
original state of the task is preserved over the blocking period, and
any regular (non lock related) wakeup has to be targeted at the
saved state to ensure that these wakeups are not lost.

Once the task acquires the lock it restores the task state from the saved state.

To avoid cluttering try_to_wake_up() with that logic, split the wakeup
state check out into an inline helper and use it at both places where
task::__state is checked against the state argument of try_to_wake_up().

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210815211302.088945085@linutronix.de
kernel/sched/core.c