Skip to content

Commit be9b7b6

Browse files
committed
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
2 parents 829d680 + 1ac8ec2 commit be9b7b6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

kernel/printk/printk.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,6 +3380,7 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
33803380
diff = 0;
33813381

33823382
console_lock();
3383+
33833384
for_each_console(c) {
33843385
if (con && con != c)
33853386
continue;
@@ -3389,11 +3390,19 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
33893390
if (printk_seq < seq)
33903391
diff += seq - printk_seq;
33913392
}
3392-
console_unlock();
33933393

3394-
if (diff != last_diff && reset_on_progress)
3394+
/*
3395+
* If consoles are suspended, it cannot be expected that they
3396+
* make forward progress, so timeout immediately. @diff is
3397+
* still used to return a valid flush status.
3398+
*/
3399+
if (console_suspended)
3400+
remaining = 0;
3401+
else if (diff != last_diff && reset_on_progress)
33953402
remaining = timeout_ms;
33963403

3404+
console_unlock();
3405+
33973406
if (diff == 0 || remaining == 0)
33983407
break;
33993408

0 commit comments

Comments
 (0)