[PATCH][v4] hung_task: Panic when there are more than N hung tasks at the same time
    Andrew Jeffery 
    andrew at codeconstruct.com.au
       
    Fri Oct 17 16:17:45 AEDT 2025
    
    
  
On Wed, 2025-10-15 at 14:36 +0800, lirongqing wrote:
> From: Li RongQing <lirongqing at baidu.com>
> 
> Currently, when 'hung_task_panic' is enabled, the kernel panics
> immediately upon detecting the first hung task. However, some hung
> tasks are transient and allow system recovery, while persistent hangs
> should trigger a panic when accumulating beyond a threshold.
> 
> Extend the 'hung_task_panic' sysctl to accept a threshold value
> specifying the number of hung tasks that must be detected before
> triggering a kernel panic. This provides finer control for environments
> where transient hangs may occur but persistent hangs should be fatal.
> 
> The sysctl now accepts:
> - 0: don't panic (maintains original behavior)
> - 1: panic on first hung task (maintains original behavior)
> - N > 1: panic after N hung tasks are detected in a single scan
> 
> This maintains backward compatibility while providing flexibility for
> different hang scenarios.
> 
> Signed-off-by: Li RongQing <lirongqing at baidu.com>
> Cc: Andrew Jeffery <andrew at codeconstruct.com.au>
> Cc: Anshuman Khandual <anshuman.khandual at arm.com>
> Cc: Arnd Bergmann <arnd at arndb.de>
> Cc: David Hildenbrand <david at redhat.com>
> Cc: Florian Wesphal <fw at strlen.de>
> Cc: Jakub Kacinski <kuba at kernel.org>
> Cc: Jason A. Donenfeld <jason at zx2c4.com>
> Cc: Joel Granados <joel.granados at kernel.org>
> Cc: Joel Stanley <joel at jms.id.au>
> Cc: Jonathan Corbet <corbet at lwn.net>
> Cc: Kees Cook <kees at kernel.org>
> Cc: Lance Yang <lance.yang at linux.dev>
> Cc: Liam Howlett <liam.howlett at oracle.com>
> Cc: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
> Cc: "Masami Hiramatsu (Google)" <mhiramat at kernel.org>
> Cc: "Paul E . McKenney" <paulmck at kernel.org>
> Cc: Pawan Gupta <pawan.kumar.gupta at linux.intel.com>
> Cc: Petr Mladek <pmladek at suse.com>
> Cc: Phil Auld <pauld at redhat.com>
> Cc: Randy Dunlap <rdunlap at infradead.org>
> Cc: Russell King <linux at armlinux.org.uk>
> Cc: Shuah Khan <shuah at kernel.org>
> Cc: Simon Horman <horms at kernel.org>
> Cc: Stanislav Fomichev <sdf at fomichev.me>
> Cc: Steven Rostedt <rostedt at goodmis.org>
> ---
> diff with v3: comments modification, suggested by Lance, Masami, Randy and Petr
> diff with v2: do not add a new sysctl, extend hung_task_panic, suggested by Kees Cook
> 
>  Documentation/admin-guide/kernel-parameters.txt      | 20 +++++++++++++-------
>  Documentation/admin-guide/sysctl/kernel.rst          |  9 +++++----
>  arch/arm/configs/aspeed_g5_defconfig                 |  2 +-
For the aspeed_g5_defconfig change:
Acked-by: Andrew Jeffery <andrew at codeconstruct.com.au>
    
    
More information about the Linux-aspeed
mailing list