[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171204134825.7822-4-sergey.senozhatsky@gmail.com>
Date: Mon, 4 Dec 2017 22:48:16 +0900
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Petr Mladek <pmladek@...e.com>
Cc: Jan Kara <jack@...e.cz>, Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Rafael Wysocki <rjw@...ysocki.net>,
Pavel Machek <pavel@....cz>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: [RFC][PATCHv6 03/12] printk: consider watchdogs thresholds for offloading
There are several watchdogs, using different timeout values, so
we need to set printk offloading threshold appropriately. This
patch set extends offloading_threshold() to take RCU, softlockup
and hardlockup timeouts into consideration.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
---
kernel/printk/printk.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f4e84f83bff5..3d4df3f02854 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -492,10 +492,29 @@ void printk_emergency_end(void)
}
EXPORT_SYMBOL_GPL(printk_emergency_end);
+/*
+ * Adjust max timeout value in the following order:
+ * a) 1/2 of RCU stall timeout - it is usually the largest
+ * b) 1/2 of hardlockup threshold (if enabled) - lower than softlockup
+ * c) 1/2 of softlockup threshold (if enabled)
+ * e) default value - 10 seconds
+ */
static inline int offloading_threshold(void)
{
+ int timeout = CONFIG_RCU_CPU_STALL_TIMEOUT / 2 + 1;
+
+#ifdef CONFIG_LOCKUP_DETECTOR
+ /* Hardlockup detector has a sample_period of `watchdog_thresh'. */
+ if ((watchdog_enabled & NMI_WATCHDOG_ENABLED) && watchdog_thresh)
+ return min(timeout, watchdog_thresh / 2) + 1;
+
+ /* Softlockup uses '2 * watchdog_thresh' as a threshold value. */
+ if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh)
+ return min(timeout, watchdog_thresh) + 1;
+#endif
+
/* Default threshold value is 10 seconds */
- return 10;
+ return min(10, timeout);
}
/*
--
2.15.1
Powered by blists - more mailing lists