[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220807151757.18466-1-puyou.lu@gmail.com>
Date: Sun, 7 Aug 2022 23:17:55 +0800
From: Puyou Lu <puyou.lu@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Puyou Lu <puyou.lu@...il.com>, Petr Mladek <pmladek@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Phil Auld <pauld@...hat.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
John Ogness <john.ogness@...utronix.de>,
Laurent Dufour <ldufour@...ux.ibm.com>,
Frederic Weisbecker <frederic@...nel.org>,
Xiaoming Ni <nixiaoming@...wei.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] watchdog: enable watchdog only when watchdog_thresh != 0
We can simplify the check of watchdog_thresh, as watchdog_thresh
shouldn't be zero for both nmi and soft watchdog.
Signed-off-by: Puyou Lu <puyou.lu@...il.com>
---
kernel/watchdog.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 8e61f21e7e33..bed1fe7ecaea 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -144,7 +144,7 @@ void __weak watchdog_nmi_start(void) { }
static void lockup_detector_update_enable(void)
{
watchdog_enabled = 0;
- if (!watchdog_user_enabled)
+ if (!(watchdog_user_enabled && watchdog_thresh))
return;
if (nmi_watchdog_available && nmi_watchdog_user_enabled)
watchdog_enabled |= NMI_WATCHDOG_ENABLED;
@@ -306,7 +306,7 @@ static int is_softlockup(unsigned long touch_ts,
unsigned long period_ts,
unsigned long now)
{
- if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh){
+ if (watchdog_enabled & SOFT_WATCHDOG_ENABLED) {
/* Warn about unreasonable delays. */
if (time_after(now, period_ts + get_softlockup_thresh()))
return now - touch_ts;
@@ -543,9 +543,10 @@ static void __lockup_detector_reconfigure(void)
watchdog_nmi_stop();
softlockup_stop_all();
+
set_sample_period();
lockup_detector_update_enable();
- if (watchdog_enabled && watchdog_thresh)
+ if (watchdog_enabled & SOFT_WATCHDOG_ENABLED)
softlockup_start_all();
watchdog_nmi_start();
@@ -575,8 +576,7 @@ static __init void lockup_detector_setup(void)
*/
lockup_detector_update_enable();
- if (!IS_ENABLED(CONFIG_SYSCTL) &&
- !(watchdog_enabled && watchdog_thresh))
+ if (!IS_ENABLED(CONFIG_SYSCTL) && !watchdog_enabled)
return;
mutex_lock(&watchdog_mutex);
--
2.17.1
Powered by blists - more mailing lists