[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250724072326.2031432-1-ye.liu@linux.dev>
Date: Thu, 24 Jul 2025 15:23:25 +0800
From: Ye Liu <ye.liu@...ux.dev>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ye Liu <liuye@...inos.cn>,
Lance Yang <lance.yang@...ux.dev>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] hung_task: Add detection count to hung task warning message
From: Ye Liu <liuye@...inos.cn>
Add [#N] to hung task warnings to show occurrence count.
This helps quickly identify warning order when multiple
messages appear in logs.
Signed-off-by: Ye Liu <liuye@...inos.cn>
Changes in v2:
- Directly use sysctl_hung_task_detect_count.
- Link to v1:https://lore.kernel.org/all/20250721031755.1418556-1-ye.liu@linux.dev/
---
kernel/hung_task.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 8708a1205f82..231afdb68bb2 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -232,8 +232,9 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
if (sysctl_hung_task_warnings || hung_task_call_panic) {
if (sysctl_hung_task_warnings > 0)
sysctl_hung_task_warnings--;
- pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
- t->comm, t->pid, (jiffies - t->last_switch_time) / HZ);
+ pr_err("INFO: task %s:%d blocked for more than %ld seconds. [#%ld]\n",
+ t->comm, t->pid, (jiffies - t->last_switch_time) / HZ,
+ sysctl_hung_task_detect_count);
pr_err(" %s %s %.*s\n",
print_tainted(), init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
--
2.43.0
Powered by blists - more mailing lists