linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoming Ni <nixiaoming@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-leds@vger.kernel.org>,
	<pavel@ucw.cz>, <dmurphy@ti.com>, <akpm@linux-foundation.org>,
	<keescook@chromium.org>, <gpiccoli@canonical.com>,
	<penguin-kernel@i-love.sakura.ne.jp>, <rdunlap@infradead.org>
Cc: <nixiaoming@huawei.com>, <wangle6@huawei.com>
Subject: [PATCH v2 2/4] hung_task: Replace "did_panic" with in_panic_state()
Date: Sun, 20 Dec 2020 11:45:03 +0800	[thread overview]
Message-ID: <20201220034505.113118-3-nixiaoming@huawei.com> (raw)
In-Reply-To: <20201220034505.113118-1-nixiaoming@huawei.com>

Replace the global variable "did_panic" with in_panic_state()

Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
---
 kernel/hung_task.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index bb2e3e15c84c..2747cd6dd35e 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -50,7 +50,6 @@ unsigned long __read_mostly sysctl_hung_task_check_interval_secs;
 
 int __read_mostly sysctl_hung_task_warnings = 10;
 
-static int __read_mostly did_panic;
 static bool hung_task_show_lock;
 static bool hung_task_call_panic;
 static bool hung_task_show_all_bt;
@@ -72,18 +71,6 @@ unsigned int __read_mostly sysctl_hung_task_all_cpu_backtrace;
 unsigned int __read_mostly sysctl_hung_task_panic =
 				CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE;
 
-static int
-hung_task_panic(struct notifier_block *this, unsigned long event, void *ptr)
-{
-	did_panic = 1;
-
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block panic_block = {
-	.notifier_call = hung_task_panic,
-};
-
 static void check_hung_task(struct task_struct *t, unsigned long timeout)
 {
 	unsigned long switch_count = t->nvcsw + t->nivcsw;
@@ -223,7 +210,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 	 * If the system crashed already then all bets are off,
 	 * do not report extra hung tasks:
 	 */
-	if (test_taint(TAINT_DIE) || did_panic)
+	if (test_taint(TAINT_DIE) || unlikely(in_panic_state()))
 		return;
 
 	hung_task_show_lock = false;
@@ -347,8 +334,6 @@ static int watchdog(void *dummy)
 
 static int __init hung_task_init(void)
 {
-	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
-
 	/* Disable hung task detector on suspend */
 	pm_notifier(hungtask_pm_notify, 0);
 
-- 
2.27.0


  parent reply	other threads:[~2020-12-20  3:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20  3:45 [PATCH v2 0/4] panic: Add new API in_panic_state() Xiaoming Ni
2020-12-20  3:45 ` [PATCH v2 1/4] " Xiaoming Ni
2020-12-20  3:45 ` Xiaoming Ni [this message]
2020-12-20  3:45 ` [PATCH v2 3/4] leds:trigger:ledtrig-activity Replace "panic_detected" with in_panic_state() Xiaoming Ni
2020-12-20  3:45 ` [PATCH v2 4/4] leds:trigger:ledtrig-heartbeat: Replace "panic_heartbeats" " Xiaoming Ni

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=20201220034505.113118-3-nixiaoming@huawei.com \
    --to=nixiaoming@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dmurphy@ti.com \
    --cc=gpiccoli@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rdunlap@infradead.org \
    --cc=wangle6@huawei.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;
as well as URLs for NNTP newsgroup(s).