[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170815025625.1977-9-sergey.senozhatsky@gmail.com>
Date: Tue, 15 Aug 2017 11:56:20 +0900
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>
Cc: Jan Kara <jack@...e.cz>, Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Eric Biederman <ebiederm@...ssion.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>, Pavel Machek <pavel@....cz>,
Andreas Mohr <andi@...as.de>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Subject: [RFC][PATCHv5 08/13] printk: set watchdog_thresh as maximum value for atomic_print_limit
There is no point in setting `atomic_print_limit' significantly
larger than watchdog's lockup threshold. This highly increases
the chances of lockups. Watchdog's softlockup threshold is
`2 * watchdog_thresh', but we limit `atomic_print_limit' to just
`watchdog_thresh'.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
---
kernel/printk/printk.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index b14e35f94596..12284aa30025 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -545,6 +545,19 @@ int printk_emergency_end_sync(void)
}
EXPORT_SYMBOL_GPL(printk_emergency_end_sync);
+/*
+ * We offload to make watchdog lockup detector happy, there is little
+ * point (no point at all) in setting `atomic_print_limit' larger than
+ * `watchdog_thresh'.
+ */
+static inline void adj_atomic_print_limit(void)
+{
+#ifdef CONFIG_LOCKUP_DETECTOR
+ if (watchdog_thresh && atomic_print_limit > watchdog_thresh)
+ atomic_print_limit = watchdog_thresh;
+#endif
+}
+
/*
* Under heavy printing load or with a slow serial console (or both)
* console_unlock() can stall CPUs, which can result in soft/hard-lockups,
@@ -580,6 +593,8 @@ static inline bool console_offload_printing(void)
if (current == printk_kthread)
return false;
+ adj_atomic_print_limit();
+
if (!time_after_eq(now, printing_start_ts + atomic_print_limit))
return false;
--
2.14.1
Powered by blists - more mailing lists