From: Puyou Lu <puyou.lu@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Puyou Lu <puyou.lu@gmail.com>, Petr Mladek <pmladek@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
Phil Auld <pauld@redhat.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
John Ogness <john.ogness@linutronix.de>,
Laurent Dufour <ldufour@linux.ibm.com>,
Frederic Weisbecker <frederic@kernel.org>,
Xiaoming Ni <nixiaoming@huawei.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] watchdog: enable watchdog only when watchdog_thresh != 0
Date: Sun, 7 Aug 2022 23:17:55 +0800 [thread overview]
Message-ID: <20220807151757.18466-1-puyou.lu@gmail.com> (raw)
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@gmail.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
reply other threads:[~2022-08-07 15:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220807151757.18466-1-puyou.lu@gmail.com \
--to=puyou.lu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=frederic@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=ldufour@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=nixiaoming@huawei.com \
--cc=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®