public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Lance Yang <lance.yang@linux.dev>
Cc: "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"joel.granados@kernel.org" <joel.granados@kernel.org>,
	"feng.tang@linux.alibaba.com" <feng.tang@linux.alibaba.com>,
	"pauld@redhat.com" <pauld@redhat.com>,
	"kees@kernel.org" <kees@kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"pawan.kumar.gupta@linux.intel.com"
	<pawan.kumar.gupta@linux.intel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"paulmck@kernel.org" <paulmck@kernel.org>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"mhiramat@kernel.org" <mhiramat@kernel.org>
Subject: RE: [外部邮件] Re: [PATCH] hung_task: Panic after fixed number of hung tasks
Date: Sun, 28 Sep 2025 01:54:33 +0000	[thread overview]
Message-ID: <bfe6df93ed8e4eb1b5191d4f7be719f7@baidu.com> (raw)
In-Reply-To: <3ae5cbea-d320-4d28-a894-5e11e048158f@linux.dev>

> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >   Documentation/admin-guide/sysctl/kernel.rst |  6 ++++++
> >   kernel/hung_task.c                          | 14 +++++++++++++-
> >   2 files changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/admin-guide/sysctl/kernel.rst
> > b/Documentation/admin-guide/sysctl/kernel.rst
> > index 8b49eab..4240e7b 100644
> > --- a/Documentation/admin-guide/sysctl/kernel.rst
> > +++ b/Documentation/admin-guide/sysctl/kernel.rst
> > @@ -405,6 +405,12 @@ This file shows up if
> ``CONFIG_DETECT_HUNG_TASK`` is enabled.
> >   1 Panic immediately.
> >   = =================================================
> >
> > +hung_task_count_to_panic
> > +=====================
> > +
> > +When set to a non-zero value, after the number of consecutive hung
> > +task occur, the kernel will triggers a panic
> 
> Hmm... the documentation here seems a bit misleading.
> 
> hung_task_panic=1 will always cause an immediate panic, regardless of the
> hung_task_count_to_panic setting, right?
> 
> Perhaps something like this would be more accurate?
> 
> ```
> hung_task_count_to_panic
> ========================
> 
> When set to a non-zero value, a kernel panic will be triggered if the number of
> detected hung tasks reaches this value.
> 
> Note that setting hung_task_panic=1 will still cause an immediate panic on the
> first hung task, overriding this setting.
> ```


I will rewrite this documentation as your suggestions


> 
> >
> >   hung_task_check_count
> >   =====================
> > diff --git a/kernel/hung_task.c b/kernel/hung_task.c index
> > 8708a12..87a6421 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_count_to_panic;
> 
> Nit: while static variables are guaranteed to be zero-initialized, it's a good
> practice and clearer for readers to initialize them explicitly.
> 
> static unsigned int __read_mostly sysctl_hung_task_count_to_panic = 0;
> 


Ok, I will change it

Thanks

-Li

> 
> Otherwise, this patch looks good to me!
> Acked-by: Lance Yang <lance.yang@linux.dev>
> 
> > +
> >   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_count_to_panic &&
> > +	     (sysctl_hung_task_detect_count >=
> > +sysctl_hung_task_count_to_panic))) {
> >   		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_count_to_panic",
> > +		.data		= &sysctl_hung_task_count_to_panic,
> > +		.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),


  reply	other threads:[~2025-09-28  1:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25  6:06 [PATCH] hung_task: Panic after fixed number of hung tasks lirongqing
2025-09-25  7:37 ` Hillf Danton
2025-09-25  8:03   ` [外部邮件] " Li,Rongqing
2025-09-25 10:26 ` Lance Yang
2025-09-26 18:02   ` Paul E. McKenney
2025-09-27  2:18     ` Lance Yang
2025-09-28  1:51     ` [????] " Li,Rongqing
2025-09-27  2:39 ` Lance Yang
2025-09-28  1:54   ` Li,Rongqing [this message]
2025-09-28  3:19   ` [外部邮件] " Li,Rongqing
2025-09-28  3:29     ` Lance Yang

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=bfe6df93ed8e4eb1b5191d4f7be719f7@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