[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <023621f3c477d6246e27d11b78ae28a2bcb47e8d.1730133890.git.chris@chrisdown.name>
Date: Mon, 28 Oct 2024 16:45:31 +0000
From: Chris Down <chris@...isdown.name>
To: Petr Mladek <pmladek@...e.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Tony Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: [PATCH v6 01/11] printk: Avoid delaying messages that aren't
solicited by any console
printk_delay() may introduce delays even when no console wants to emit
the message, which is unnecessary and may hold back messages we actually
care about. Add a check in printk_delay() to determine if any console
will print the message to avoid introducing unnecessary delays. This
change aligns with the existing behaviour of boot-delayed printk
messages, which already have a similar check.
Signed-off-by: Chris Down <chris@...isdown.name>
Reviewed-by: Petr Mladek <pmladek@...e.com>
---
kernel/printk/printk.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index beb808f4c367..d6159f1c5b29 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1315,15 +1315,13 @@ static int __init boot_delay_setup(char *str)
}
early_param("boot_delay", boot_delay_setup);
-static void boot_delay_msec(int level)
+static void boot_delay_msec(void)
{
unsigned long long k;
unsigned long timeout;
- if ((boot_delay == 0 || system_state >= SYSTEM_RUNNING)
- || suppress_message_printing(level)) {
+ if (boot_delay == 0 || system_state >= SYSTEM_RUNNING)
return;
- }
k = (unsigned long long)loops_per_msec * boot_delay;
@@ -1342,7 +1340,7 @@ static void boot_delay_msec(int level)
}
}
#else
-static inline void boot_delay_msec(int level)
+static inline void boot_delay_msec(void)
{
}
#endif
@@ -2124,7 +2122,10 @@ int printk_delay_msec __read_mostly;
static inline void printk_delay(int level)
{
- boot_delay_msec(level);
+ if (suppress_message_printing(level))
+ return;
+
+ boot_delay_msec();
if (unlikely(printk_delay_msec)) {
int m = printk_delay_msec;
--
2.46.0
Powered by blists - more mailing lists