lkml.org 
[lkml]   [2017]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCHv6 03/12] printk: consider watchdogs thresholds for offloading
Date
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@gmail.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
\
 
 \ /
  Last update: 2017-12-04 14:52    [W:0.935 / U:1.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site