mirror_ubuntu-kernels/include/linux/sched
Peter Zijlstra 6b596e62ed 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
2023-09-20 09:31:12 +02:00
..
affinity.h
autogroup.h
clock.h sched/clock: Provide local_clock_noinstr() 2023-06-05 21:11:09 +02:00
cond_resched.h
coredump.h
cpufreq.h
cputime.h
deadline.h
debug.h
hotplug.h
idle.h
init.h
isolation.h
jobctl.h
loadavg.h
mm.h IOMMU Updates for Linux 6.4 2023-04-30 13:00:38 -07:00
nohz.h
numa_balancing.h
posix-timers.h
prio.h
rseq_api.h
rt.h sched: Provide rt_mutex specific scheduler helpers 2023-09-20 09:31:12 +02:00
sd_flags.h sched/topology: Remove SHARED_CHILD from ASYM_PACKING 2023-05-08 10:58:37 +02:00
signal.h document while_each_thread(), change first_tid() to use for_each_thread() 2023-08-24 16:25:15 -07:00
smt.h
stat.h
sysctl.h
task_flags.h
task_stack.h
task.h sched: avoid false lockdep splat in put_task_struct() 2023-07-13 15:21:48 +02:00
thread_info_api.h
topology.h sched/topology: Mark set_sched_topology() __init 2023-06-16 17:08:01 +02:00
types.h
user.h
vhost_task.h fork, vhost: Use CLONE_THREAD to fix freezer/ps regression 2023-06-01 17:15:33 -04:00
wake_q.h
xacct.h