From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F188268C42 for ; Mon, 17 Nov 2025 17:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763402035; cv=none; b=FDbB5PvOdoip2YDk3ZLFUXIh1Llh0/NAEmkPYkrTpXhK/wUG3+T3IPyy8ArJG48VMQK4R9n2qKPwYqVJyJ78GQG25EKfhh7/5foliBVjrPDML2WuZGwQ3JUCnlDM1fcEyweilUef4RrShoCDY5iD8Q+nN5k7DWW9O1hre7bLRrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763402035; c=relaxed/simple; bh=m5R4GFQ8BKgM5RJngwwUSds/hSEZ6UD9HGf1LGGP/EU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Nf8duJISdrXa45naz7jnwzLA6RlJU/lCP+5fRFvXOsWHrmj6FzrDXvz+DhFYfH6aZ2XBuIROc57BzWjLqfqUtzM7MLCVddiU5akp9rzKSvSMMuSe2IQQP/F2HpAufmYM4ulrNrtIx9sXweeRsC3eP0KofGjBRUU5il+QFAOuw3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=aGdLLsbs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="aGdLLsbs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BF01C2BCB4; Mon, 17 Nov 2025 17:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1763402034; bh=m5R4GFQ8BKgM5RJngwwUSds/hSEZ6UD9HGf1LGGP/EU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aGdLLsbsEZ9FjTyjNWtO9mvBS/tecq3UVqn7xHxTXyaNT94am3IuqywKF2ajdfVsW 4z5OCX4/z4GvowhQULqVqvvUE0DL0tR2V2quClLDRD0t6WS8dIMgX2Jm2dkmCSCYJl q5qHPqFL5E9DDXCUn6a2qpeDXPcFnolu1HG+qajY= Date: Mon, 17 Nov 2025 09:53:52 -0800 From: Andrew Morton To: Feng Tang Cc: Lance Yang , Petr Mladek , Steven Rostedt , Lance Yang , linux-kernel@vger.kernel.org, Jonathan Corbet , paulmck@kernel.org, lirongqing@baidu.com, leonylgao@tencent.com Subject: Re: [PATCH v2 2/4] hung_task: Add hung_task_sys_info sysctl to dump sys info on task-hung Message-Id: <20251117095352.8dfb46ec468ba5a69a829031@linux-foundation.org> In-Reply-To: References: <20251113111039.22701-1-feng.tang@linux.alibaba.com> <20251113111039.22701-3-feng.tang@linux.alibaba.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 16 Nov 2025 22:13:58 +0800 Feng Tang wrote: > > > if (need_warning || hung_task_call_panic) { > > > si_mask |= SYS_INFO_LOCKS; > > > > Looks good to me now! I assume v3 would be expected, can you > > post a new version? > > Andrew has taken the patchset to -mm tree. > > Andrew, which way do you prefer? I send a v3 patch for hung-task or you > pickup the fixup patch and squash it into the orginal 0002 patch? > > Anyway, I make a squshed version v3 patch below. I prefer little fixup patches, generally. So people can see what changed and don't feel they should re-review everything. I queued the below, thanks. From: Feng Tang Subject: hung_task-add-hung_task_sys_info-sysctl-to-dump-sys-info-on-task-hung-fix Date: Wed, 5 Nov 2025 19:30:36 +0800 maintain consistecy established behavior, per Lance and Petr Link: https://lkml.kernel.org/r/aRncJo1mA5Zk77Hr@U-2FWC9VHC-2323.local Suggested-by: Petr Mladek Signed-off-by: Feng Tang Cc: Jonathan Corbet Cc: Lance Yang Cc: "Paul E . McKenney" Cc: Steven Rostedt Signed-off-by: Andrew Morton --- kernel/hung_task.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/kernel/hung_task.c~hung_task-add-hung_task_sys_info-sysctl-to-dump-sys-info-on-task-hung-fix +++ a/kernel/hung_task.c @@ -223,8 +223,11 @@ static inline void debug_show_blocker(st } #endif -static void check_hung_task(struct task_struct *t, unsigned long timeout) +static void check_hung_task(struct task_struct *t, unsigned long timeout, + unsigned long prev_detect_count) { + unsigned long total_hung_task; + if (!task_is_hung(t, timeout)) return; @@ -234,13 +237,19 @@ static void check_hung_task(struct task_ */ sysctl_hung_task_detect_count++; + total_hung_task = sysctl_hung_task_detect_count - prev_detect_count; trace_sched_process_hang(t); + if (sysctl_hung_task_panic && total_hung_task >= sysctl_hung_task_panic) { + console_verbose(); + hung_task_call_panic = true; + } + /* * Ok, the task did not get scheduled for more than 2 minutes, * complain: */ - if (sysctl_hung_task_warnings) { + 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", @@ -295,7 +304,6 @@ static void check_hung_uninterruptible_t { int max_count = sysctl_hung_task_check_count; unsigned long last_break = jiffies; - unsigned long total_hung_task; struct task_struct *g, *t; unsigned long prev_detect_count = sysctl_hung_task_detect_count; int need_warning = sysctl_hung_task_warnings; @@ -320,20 +328,14 @@ static void check_hung_uninterruptible_t last_break = jiffies; } - check_hung_task(t, timeout); + check_hung_task(t, timeout, prev_detect_count); } unlock: rcu_read_unlock(); - total_hung_task = sysctl_hung_task_detect_count - prev_detect_count; - if (!total_hung_task) + if (!(sysctl_hung_task_detect_count - prev_detect_count)) return; - if (sysctl_hung_task_panic && total_hung_task >= sysctl_hung_task_panic) { - console_verbose(); - hung_task_call_panic = true; - } - if (need_warning || hung_task_call_panic) { si_mask |= SYS_INFO_LOCKS; _