diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 01:02:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 01:02:38 +0000 |
commit | 08b74a000942a380fe028845f92cd3a0dee827d5 (patch) | |
tree | aa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch | |
parent | Adding upstream version 4.19.249. (diff) | |
download | linux-08b74a000942a380fe028845f92cd3a0dee827d5.tar.xz linux-08b74a000942a380fe028845f92cd3a0dee827d5.zip |
Adding debian version 4.19.249-2.debian/4.19.249-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch')
-rw-r--r-- | debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch b/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch new file mode 100644 index 000000000..e02a45c7e --- /dev/null +++ b/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch @@ -0,0 +1,45 @@ +From 495d970d1b7c60361c296ff0e613787355a1cbd3 Mon Sep 17 00:00:00 2001 +From: Steven Rostedt <rostedt@goodmis.org> +Date: Mon, 18 Mar 2013 15:12:49 -0400 +Subject: [PATCH 113/347] sched/workqueue: Only wake up idle workers if not + blocked on sleeping spin lock +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz + +In -rt, most spin_locks() turn into mutexes. One of these spin_lock +conversions is performed on the workqueue gcwq->lock. When the idle +worker is worken, the first thing it will do is grab that same lock and +it too will block, possibly jumping into the same code, but because +nr_running would already be decremented it prevents an infinite loop. + +But this is still a waste of CPU cycles, and it doesn't follow the method +of mainline, as new workers should only be woken when a worker thread is +truly going to sleep, and not just blocked on a spin_lock(). + +Check the saved_state too before waking up new workers. + + +Signed-off-by: Steven Rostedt <rostedt@goodmis.org> +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + kernel/sched/core.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 52e821ac5872..dadf92046f01 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3544,8 +3544,10 @@ static void __sched notrace __schedule(bool preempt) + * If a worker went to sleep, notify and ask workqueue + * whether it wants to wake up a task to maintain + * concurrency. ++ * Only call wake up if prev isn't blocked on a sleeping ++ * spin lock. + */ +- if (prev->flags & PF_WQ_WORKER) { ++ if (prev->flags & PF_WQ_WORKER && !prev->saved_state) { + struct task_struct *to_wakeup; + + to_wakeup = wq_worker_sleeping(prev); +-- +2.36.1 + |