[PATCH] hung_task: Print message when hung_task_warnings gets down to zero.

fuyuanli posted 1 patch 2 years, 7 months ago
kernel/hung_task.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] hung_task: Print message when hung_task_warnings gets down to zero.
Posted by fuyuanli 2 years, 7 months ago
It's useful to report it when hung_task_warnings gets down to zero,
so that we can know if kernel log was lost or there is no hung task
was detected.

Signed-off-by: fuyuanli <fuyuanli@didiglobal.com>
---
 kernel/hung_task.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index bb2354f73ded..ff479c51143d 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -142,6 +142,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 
 		if (sysctl_hung_task_all_cpu_backtrace)
 			hung_task_show_all_bt = true;
+		if (!sysctl_hung_task_warnings)
+			pr_info("Future hung task reports are suppressed, see sysctl kernel.hung_task_warnings\n");
 	}
 
 	touch_nmi_watchdog();
-- 
2.17.1
Re: [PATCH] hung_task: Print message when hung_task_warnings gets down to zero.
Posted by Petr Mladek 2 years, 7 months ago
On Wed 2023-02-01 21:54:33, fuyuanli wrote:
> It's useful to report it when hung_task_warnings gets down to zero,
> so that we can know if kernel log was lost or there is no hung task
> was detected.
> 
> Signed-off-by: fuyuanli <fuyuanli@didiglobal.com>

Looks good to me.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr