Commit c8bbfb7e authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Elliot Berman
Browse files

UPSTREAM: sched: Consider task_struct::saved_state in wait_task_inactive()



With the introduction of task_struct::saved_state in commit
5f220be2 ("sched/wakeup: Prepare for RT sleeping spin/rwlocks")
matching the task state has gotten more complicated. That same commit
changed try_to_wake_up() to consider both states, but
wait_task_inactive() has been neglected.

Sebastian noted that the wait_task_inactive() usage in
ptrace_check_attach() can misbehave when ptrace_stop() is blocked on
the tasklist_lock after it sets TASK_TRACED.

Therefore extract a common helper from ttwu_state_match() and use that
to teach wait_task_inactive() about the PREEMPT_RT locks.

Originally-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lkml.kernel.org/r/20230601091234.GW83892@hirez.programming.kicks-ass.net



(cherry picked from commit 1c069187)
Bug: 292064955
Bug: 304294320
Change-Id: I2cc02dfdf3c04be146078f80d09c3a87979d79a6
Signed-off-by: default avatarElliot Berman <quic_eberman@quicinc.com>
(cherry picked from commit ac900594)
parent 424eb5ae
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment