diff options
Diffstat (limited to 'debian/patches-rt/sched-rt-mutex-wakeup.patch')
-rw-r--r-- | debian/patches-rt/sched-rt-mutex-wakeup.patch | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/debian/patches-rt/sched-rt-mutex-wakeup.patch b/debian/patches-rt/sched-rt-mutex-wakeup.patch index b5bc8c7cb..fac8c65fc 100644 --- a/debian/patches-rt/sched-rt-mutex-wakeup.patch +++ b/debian/patches-rt/sched-rt-mutex-wakeup.patch @@ -1,7 +1,7 @@ Subject: sched: Add saved_state for tasks blocked on sleeping locks From: Thomas Gleixner <tglx@linutronix.de> Date: Sat, 25 Jun 2011 09:21:04 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patches-5.2.17-rt9.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.3-rt1.tar.xz Spinlocks are state preserving in !RT. RT changes the state when a task gets blocked on a lock. So we need to remember the state before @@ -12,13 +12,13 @@ sleep is done, the saved state is restored. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- include/linux/sched.h | 3 +++ - kernel/sched/core.c | 33 ++++++++++++++++++++++++++++++++- + kernel/sched/core.c | 42 +++++++++++++++++++++++++++++++++++++++--- kernel/sched/sched.h | 1 + - 3 files changed, 36 insertions(+), 1 deletion(-) + 3 files changed, 43 insertions(+), 3 deletions(-) --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -591,6 +591,8 @@ struct task_struct { +@@ -631,6 +631,8 @@ struct task_struct { #endif /* -1 unrunnable, 0 runnable, >0 stopped: */ volatile long state; @@ -27,7 +27,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> /* * This begins the randomizable portion of task_struct. Only -@@ -1638,6 +1640,7 @@ extern struct task_struct *find_get_task +@@ -1679,6 +1681,7 @@ extern struct task_struct *find_get_task extern int wake_up_state(struct task_struct *tsk, unsigned int state); extern int wake_up_process(struct task_struct *tsk); @@ -37,11 +37,30 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> #ifdef CONFIG_SMP --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -2026,8 +2026,27 @@ try_to_wake_up(struct task_struct *p, un +@@ -2523,6 +2523,8 @@ try_to_wake_up(struct task_struct *p, un + int cpu, success = 0; + + preempt_disable(); ++ ++#ifndef CONFIG_PREEMPT_RT + if (p == current) { + /* + * We're waking current, this means 'p->on_rq' and 'task_cpu(p) +@@ -2545,7 +2547,7 @@ try_to_wake_up(struct task_struct *p, un + trace_sched_wakeup(p); + goto out; + } +- ++#endif + /* + * If we are going to wake up a thread waiting for CONDITION we + * need to ensure that CONDITION=1 done by the caller can not be +@@ -2554,8 +2556,27 @@ try_to_wake_up(struct task_struct *p, un */ raw_spin_lock_irqsave(&p->pi_lock, flags); smp_mb__after_spinlock(); - if (!(p->state & state)) +- goto unlock; + if (!(p->state & state)) { + /* + * The task might be running due to a spinlock sleeper @@ -54,9 +73,9 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> + success = 1; + } + } - goto out; ++ raw_spin_unlock_irqrestore(&p->pi_lock, flags); ++ goto out_nostat; + } -+ + /* + * If this is a regular wakeup, then we can unconditionally + * clear the saved state of a "lock sleeper". @@ -66,7 +85,20 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> trace_sched_waking(p); -@@ -2142,6 +2161,18 @@ int wake_up_process(struct task_struct * +@@ -2647,9 +2668,12 @@ try_to_wake_up(struct task_struct *p, un + ttwu_queue(p, cpu, wake_flags); + unlock: + raw_spin_unlock_irqrestore(&p->pi_lock, flags); ++#ifndef CONFIG_PREEMPT_RT + out: ++#endif + if (success) + ttwu_stat(p, cpu, wake_flags); ++out_nostat: + preempt_enable(); + + return success; +@@ -2672,6 +2696,18 @@ int wake_up_process(struct task_struct * } EXPORT_SYMBOL(wake_up_process); @@ -87,7 +119,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> return try_to_wake_up(p, state, 0); --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h -@@ -1591,6 +1591,7 @@ static inline int task_on_rq_migrating(s +@@ -1644,6 +1644,7 @@ static inline int task_on_rq_migrating(s #define WF_SYNC 0x01 /* Waker goes to sleep after wakeup */ #define WF_FORK 0x02 /* Child wakeup after fork */ #define WF_MIGRATED 0x4 /* Internal use, task got migrated */ |