aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-07-16 10:46:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-07-16 10:46:03 -0700
commitbe9b7b6acfeae47778f829d9d176ab1f9269593e (patch)
tree1d4f5754b9f4ee0fe567fe39d6d62f98bee017cd /kernel
parentrandom: cap jitter samples per bit to factor of HZ (diff)
parentMerge branch 'rework/kthreads' into for-linus (diff)
downloadwireguard-linux-be9b7b6acfeae47778f829d9d176ab1f9269593e.tar.xz
wireguard-linux-be9b7b6acfeae47778f829d9d176ab1f9269593e.zip
Merge tag 'printk-for-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk fix from Petr Mladek: - Make pr_flush() fast when consoles are suspended. * tag 'printk-for-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: printk: do not wait for consoles when suspended
Diffstat (limited to 'kernel')
-rw-r--r--kernel/printk/printk.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index b49c6ff6dca0..a1a81fd9889b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3380,6 +3380,7 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
diff = 0;
console_lock();
+
for_each_console(c) {
if (con && con != c)
continue;
@@ -3389,11 +3390,19 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
if (printk_seq < seq)
diff += seq - printk_seq;
}
- console_unlock();
- if (diff != last_diff && reset_on_progress)
+ /*
+ * If consoles are suspended, it cannot be expected that they
+ * make forward progress, so timeout immediately. @diff is
+ * still used to return a valid flush status.
+ */
+ if (console_suspended)
+ remaining = 0;
+ else if (diff != last_diff && reset_on_progress)
remaining = timeout_ms;
+ console_unlock();
+
if (diff == 0 || remaining == 0)
break;