[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B0A75949-C40A-49E7-83BD-58D6BD5A1493@kernel.org>
Date: Fri, 10 Oct 2025 22:47:08 -0700
From: Kees Cook <kees@...nel.org>
To: Randy Dunlap <rdunlap@...radead.org>, lirongqing <lirongqing@...du.com>,
corbet@....net, akpm@...ux-foundation.org, lance.yang@...ux.dev,
mhiramat@...nel.org, paulmck@...nel.org, pawan.kumar.gupta@...ux.intel.com,
mingo@...nel.org, dave.hansen@...ux.intel.com, rostedt@...dmis.org,
arnd@...db.de, feng.tang@...ux.alibaba.com, pauld@...hat.com,
joel.granados@...nel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH][v2] hung_task: Panic after fixed number of hung tasks
On October 10, 2025 5:25:05 PM PDT, Randy Dunlap <rdunlap@...radead.org> wrote:
>Hi,
>
>On 9/27/25 10:31 PM, lirongqing wrote:
>> From: Li RongQing <lirongqing@...du.com>
>>
>> Currently, when hung_task_panic is enabled, kernel will panic immediately
>> upon detecting the first hung task. However, some hung tasks are transient
>> and the system can recover fully, while others are unrecoverable and
>> trigger consecutive hung task reports, and a panic is expected.
>>
>> This commit adds a new sysctl parameter hung_task_count_to_panic to allows
>> specifying the number of consecutive hung tasks that must be detected
Why make a new sysctl? Can't you just use hung_task_panic and raise the max to INT_MAX?
-Kees
>> before triggering a kernel panic. This provides finer control for
>> environments where transient hangs maybe happen but persistent hangs should
>> still be fatal.
>>
>> Acked-by: Lance Yang <lance.yang@...ux.dev>
>> Signed-off-by: Li RongQing <lirongqing@...du.com>
>> ---
>> Diff with v1: change documentation as Lance suggested
>>
>> Documentation/admin-guide/sysctl/kernel.rst | 8 ++++++++
>> kernel/hung_task.c | 14 +++++++++++++-
>> 2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
>> index 8b49eab..98b47a7 100644
>> --- a/Documentation/admin-guide/sysctl/kernel.rst
>> +++ b/Documentation/admin-guide/sysctl/kernel.rst
>> @@ -405,6 +405,14 @@ This file shows up if ``CONFIG_DETECT_HUNG_TASK`` is enabled.
>> 1 Panic immediately.
>> = =================================================
>>
>> +hung_task_count_to_panic
>> +=====================
>
>The underline length should be at least as long as the title to
>prevent kernel-doc build warnings. Same length is preferred.
>
>> +
>> +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.
>>
>> hung_task_check_count
>> =====================
>
--
Kees Cook
Powered by blists - more mailing lists