Commit 9ad89d57 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

sched/core: Schedule new worker even if PI-blocked

[ Upstream commit b0fdc013 ]

If a task is PI-blocked (blocking on sleeping spinlock) then we don't want to
schedule a new kworker if we schedule out due to lock contention because !RT
does not do that as well. A spinning spinlock disables preemption and a worker
does not schedule out on lock contention (but spin).

On RT the RW-semaphore implementation uses an rtmutex so
tsk_is_pi_blocked() will return true if a task blocks on it. In this case we
will now start a new worker which may deadlock if one worker is waiting on
progress from another worker. Since a RW-semaphore starts a new worker on !RT,
we should do the same on RT.

XFS is able to trigger this deadlock.

Allow to schedule new worker if the current worker is PI-blocked.
Signed-off-by: default avatarSebastian Andrzej Siewior <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link:[email protected]Signed-off-by: default avatarIngo Molnar <[email protected]>
Signed-off-by: default avatarSasha Levin <[email protected]>
parent 086ddc5e
......@@ -3469,7 +3469,7 @@ void __noreturn do_task_dead(void)
static inline void sched_submit_work(struct task_struct *tsk)
if (!tsk->state || tsk_is_pi_blocked(tsk))
if (!tsk->state)
......@@ -3485,6 +3485,9 @@ static inline void sched_submit_work(struct task_struct *tsk)
if (tsk_is_pi_blocked(tsk))
* If we are going to sleep and we have plugged IO queued,
* make sure to submit it to avoid deadlocks.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment