From: "Li,Rongqing" <lirongqing@baidu.com>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"lance.yang@linux.dev" <lance.yang@linux.dev>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"pawan.kumar.gupta@linux.intel.com"
<pawan.kumar.gupta@linux.intel.com>,
"mingo@kernel.org" <mingo@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"kees@kernel.org" <kees@kernel.org>,
"arnd@arndb.de" <arnd@arndb.de>,
"feng.tang@linux.alibaba.com" <feng.tang@linux.alibaba.com>,
"pauld@redhat.com" <pauld@redhat.com>,
"joel.granados@kernel.org" <joel.granados@kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [外部邮件] Re: [????] Re: [PATCH][RFC] hung_task: Support to panic when the maximum number of hung task warnings is reached
Date: Tue, 23 Sep 2025 07:01:47 +0000 [thread overview]
Message-ID: <b37376c5ed0141e5a370bf4e73c33751@baidu.com> (raw)
In-Reply-To: <36db2f10-ebbe-4ecd-b27f-e02d9e1569c2@paulmck-laptop>
> There are the panic_on_rcu_stall and max_rcu_stall_to_panic sysctls, which
> together allow you to panic after (say) three RCU CPU stall warnings.
> Does those do what you need?
>
> Thanx, Paul
>
inspired by dfe564045c653d "(rcu: Panic after fixed number of stalls)", add a new knod for hung task, how about?
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 8708a12..b93592d 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -83,6 +83,8 @@ static unsigned int __read_mostly sysctl_hung_task_all_cpu_backtrace;
static unsigned int __read_mostly sysctl_hung_task_panic =
IS_ENABLED(CONFIG_BOOTPARAM_HUNG_TASK_PANIC);
+static unsigned int __read_mostly sysctl_hung_task_panic_count;
+
static int
hung_task_panic(struct notifier_block *this, unsigned long event, void *ptr)
{
@@ -219,7 +221,9 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
trace_sched_process_hang(t);
- if (sysctl_hung_task_panic) {
+ if (sysctl_hung_task_panic ||
+ (sysctl_hung_task_panic_count &&
+ (sysctl_hung_task_detect_count > sysctl_hung_task_panic_count))) {
console_verbose();
hung_task_show_lock = true;
hung_task_call_panic = true;
@@ -388,6 +392,14 @@ static const struct ctl_table hung_task_sysctls[] = {
.extra2 = SYSCTL_ONE,
},
{
+ .procname = "hung_task_panic_count",
+ .data = &sysctl_hung_task_panic_count,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ },
+ {
.procname = "hung_task_check_count",
.data = &sysctl_hung_task_check_count,
.maxlen = sizeof(int),
next prev parent reply other threads:[~2025-09-23 7:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 3:37 lirongqing
2025-09-23 3:45 ` Andrew Morton
2025-09-23 3:59 ` Lance Yang
2025-09-23 5:22 ` [外部邮件] " Li,Rongqing
2025-09-23 5:55 ` Lance Yang
2025-09-23 6:19 ` Li,Rongqing
2025-09-23 4:00 ` [????] " Li,Rongqing
2025-09-23 6:03 ` Paul E. McKenney
2025-09-23 6:16 ` [外部邮件] " Li,Rongqing
2025-09-23 7:01 ` Li,Rongqing [this message]
2025-09-23 4:35 ` Randy Dunlap
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=b37376c5ed0141e5a370bf4e73c33751@baidu.com \
--to=lirongqing@baidu.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=feng.tang@linux.alibaba.com \
--cc=joel.granados@kernel.org \
--cc=kees@kernel.org \
--cc=lance.yang@linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=pauld@redhat.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=rostedt@goodmis.org \
/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®