mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: Ye Liu <ye.liu@linux.dev>, Andrew Morton <akpm@linux-foundation.org>
Cc: Ye Liu <liuye@kylinos.cn>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] hung_task: Add detection count to hung task warning message
Date: Thu, 24 Jul 2025 20:06:52 +0800	[thread overview]
Message-ID: <bdd8f5de-acd5-4c09-b3a4-ec6af54b396c@linux.dev> (raw)
In-Reply-To: <20250724072326.2031432-1-ye.liu@linux.dev>



On 2025/7/24 15:23, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> Add [#N] to hung task warnings to show occurrence count.
> This helps quickly identify warning order when multiple
> messages appear in logs.

Hmm... once we have this number, what do we do with it?

While I totally get the desire for a quick reference number, my thinking
is that the hung_task_detect_count counter is the intended and more
reliable way for users to check.

But like I said before, let's see what Andrew thinks ;)

Thanks,
Lance

> 
> Signed-off-by: Ye Liu <liuye@kylinos.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, " "),


  reply	other threads:[~2025-07-24 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  7:23 Ye Liu
2025-07-24 12:06 ` Lance Yang [this message]
2025-07-24 22:10   ` Andrew Morton
2025-07-25  2:24     ` 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=bdd8f5de-acd5-4c09-b3a4-ec6af54b396c@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuye@kylinos.cn \
    --cc=ye.liu@linux.dev \
    /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

all inboxes | Powered by JetHome®