summaryrefslogtreecommitdiff
path: root/include/linux/sched/rt.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2023-09-08 19:22:51 +0300
committerPeter Zijlstra <peterz@infradead.org>2023-09-20 10:31:12 +0300
commit6b596e62ed9f90c4a97e68ae1f7b1af5beeb3c05 (patch)
tree5fdde551fcf4a48f0a1046c34b6d994e0be0ffd6 /include/linux/sched/rt.h
parentde1474b46d889ee0367f6e71d9adfeb0711e4a8d (diff)
downloadlinux-6b596e62ed9f90c4a97e68ae1f7b1af5beeb3c05.tar.xz
sched: Provide rt_mutex specific scheduler helpers
With PREEMPT_RT there is a rt_mutex recursion problem where sched_submit_work() can use an rtlock (aka spinlock_t). More specifically what happens is: mutex_lock() /* really rt_mutex */ ... __rt_mutex_slowlock_locked() task_blocks_on_rt_mutex() // enqueue current task as waiter // do PI chain walk rt_mutex_slowlock_block() schedule() sched_submit_work() ... spin_lock() /* really rtlock */ ... __rt_mutex_slowlock_locked() task_blocks_on_rt_mutex() // enqueue current task as waiter *AGAIN* // *CONFUSION* Fix this by making rt_mutex do the sched_submit_work() early, before it enqueues itself as a waiter -- before it even knows *if* it will wait. [[ basically Thomas' patch but with different naming and a few asserts added ]] Originally-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230908162254.999499-5-bigeasy@linutronix.de
Diffstat (limited to 'include/linux/sched/rt.h')
-rw-r--r--include/linux/sched/rt.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 994c25640e15..b2b9e6eb9683 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -30,6 +30,10 @@ static inline bool task_is_realtime(struct task_struct *tsk)
}
#ifdef CONFIG_RT_MUTEXES
+extern void rt_mutex_pre_schedule(void);
+extern void rt_mutex_schedule(void);
+extern void rt_mutex_post_schedule(void);
+
/*
* Must hold either p->pi_lock or task_rq(p)->lock.
*/