From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5326C357A3F for ; Tue, 18 Nov 2025 15:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763479243; cv=none; b=bbOfUi6QQTg7Kn33aNTEaYzwAFF+hNA/Fdpy7Ru74GNd0c6/aprGw+UfgmLveSJQWnz7+OXrhmFDwISRzYbcMF10dINXtsKped7MDozo745xcfXUmIOgiXPUB/TCpJhwR8hL7mKCxeqGxrJysoYhJ23DyGFOf6Yp+RuVET6v7AM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763479243; c=relaxed/simple; bh=fwPIqmuQNTGa5lP1FbKKFeFcuvHzIJKfK8n7tZkvyQk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pb488JJh0vE18IafQjiaOH/nNZDawDawjuJkJUfqZeBt/oDtQG5mLmcGzBuubQlFYt30kfo2upWOpkJqIvWnXjPvLZzpKoU+UagR9K9lzD6JKXUmBaVyqs71fdA15um0uxu/QmoqT2/n/J4uEO7tlyGTWo1tx2m2Kshi1OwLJVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=CaqL1LGY; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="CaqL1LGY" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b737cd03d46so471430766b.0 for ; Tue, 18 Nov 2025 07:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1763479240; x=1764084040; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=IdtHnGlGpNS7F6IoGr8enFyULC95HfsSRzKEXXvh3cQ=; b=CaqL1LGYh1WlY92e6gFXKewyaykV1QsLo7zKGkDvJLr2cXEYYQj6r/c+GfrIL1ar1f yfs5Q9x2NPRTmQpEZmULjtgjGlWsacITfPuRr/dos0sShKOXnvQvVGpqLHLYlncrdlDz 6CDFOwRf8szgMsglZN0nDbjaRqFIx961x7GIWhLv/Cd2pnntzIKOAfG1/b1nohgM7i6k LOv1Ob5JFFUfsXyfFxJpUNmlDLKkq8HxSryaxjdoTMTq+sLwNYxfT36rcrwpv838xHzj 1HNGfjNKQQstUJYOJPvMJ8DwC99scaBO8wxhja7zfo1LTiR1pu8KjYikpm4gZ1Xgozut 29bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763479240; x=1764084040; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IdtHnGlGpNS7F6IoGr8enFyULC95HfsSRzKEXXvh3cQ=; b=n1qGq6zhDa2ujPKX3KRAZPMjnVjocOjrlyXC4nR2PayvKSTNRXTdHJJggdydSqL27Z RZ8My743ba+LTC+ojdPLSPOtQlHoZ3b/ifYdoVf0gN800bx30legrlILCI7hbz+QcUvB VUV18wkc46Be7sy/1S494LD4p5/9nMP02OSt+zH/8k1yArVtRU5nTxO77aBW4RA8Awhj GKD+iXRxtpj/BeGJuCegq/k/gReBPKXQ15Y4UT3/vPlWx2RMRYn6AHuRC1JoZK7EONxB MawWiOuNfLCTvu7TnyOrVTDlU1KSZLj0BPs3e8C387mu9+R0nNG71QPIcfezvDngy9G6 LscQ== X-Forwarded-Encrypted: i=1; AJvYcCXIwscGE8mlAC2IuuAEb4RrPmsg/X0YlELqe/tAi5vwXk/AsjugmUhj2HKZMdqhJNwc1GuAJHSVPGh3Xbk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/g6m+sSXwrUCAxWKssnY0272ZWLy4CIGtWra+Uqla3jP7Yl5M 8wyUtqI2aFabPcz7BGzHvUjO8itItlODS8hiRdDTxjLAYNMT2aRul3t9rmqm50uzKXw= X-Gm-Gg: ASbGnctFfVycoYDCGSzzyZ+PfKwBCBTVtZJBzoATE6nbQCkT/Hmdq+8guDYVHzYLK2E HKJhr1DsDk/eaIe0h4nkEll7y2il49hpWxWtuaZc56QbZMz/Q50iS+d8RFrko+PiKbp+grTYlLJ qNBJ1tgsrPimt4ShEgLCaF8oifxiP+Tz1hTbWX0CRxssk4VutfnLFZXSY8XmrKkKfnWBpKbsD98 LwCi3lUCnmbE6TQqv/iU/kRq3jXToYKI+fE0kAEijdf/8t8AD1OAw+Oc4oz5soWzicZTO+S8GrI rbfrsMQMyUeuweAMSgbEP73A+CkwqnsuUjf6E3Avo0kxlhJly6Ok2zEvk+9JO//Zu3YicTiZrXE oyAmHs6s+roBVI+o6NjLJdf7xchJwRJ69q0ChUSgq3be6Z3qWAdlHMAsdGT+3Nd/sbGtNX90rn+ +Xv18IwUsdlgbpI0V+SCk8PJCn X-Google-Smtp-Source: AGHT+IHRkok7dJpWjq0Y9oW5TyeKndyEMX1ZeqPJW43kMp6E8GtptdTQcVknCFtZR+GDoqyHUVPqsQ== X-Received: by 2002:a17:907:7e9d:b0:b71:88eb:e60c with SMTP id a640c23a62f3a-b7367bc4017mr1528863366b.44.1763479239619; Tue, 18 Nov 2025 07:20:39 -0800 (PST) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b734fad4635sm1375131266b.26.2025.11.18.07.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Nov 2025 07:20:38 -0800 (PST) Date: Tue, 18 Nov 2025 16:20:36 +0100 From: Petr Mladek To: Andrew Morton Cc: Feng Tang , Lance Yang , 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: References: <20251113111039.22701-1-feng.tang@linux.alibaba.com> <20251113111039.22701-3-feng.tang@linux.alibaba.com> <20251117095352.8dfb46ec468ba5a69a829031@linux-foundation.org> 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-Disposition: inline In-Reply-To: <20251117095352.8dfb46ec468ba5a69a829031@linux-foundation.org> On Mon 2025-11-17 09:53:52, Andrew Morton wrote: > 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 Thanks a lot for catching and fixing the regression caused by this patchset. The patch looks good. See a comment below. > --- 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", This restores the behavior after the commit 9544f9e6947f6508 ("hung_task: panic when there are more than N hung tasks at the same time"). It is better than nothing. Well, the behavior is still not ideal. It would be better when we printed backtraces from _all_ "hung" tasks before panicking. But it prints the backtraces only when sysctl_hung_task_panic limit is reached. I mean, for example, let's have: + sysctl_hung_task_warnings = 2; + sysctl_hung_task_panic = 5; + and detect 6 hung tasks. The code will report 1st and 2nd hung tasks. It will skip 3rd and 4th because sysctl_hung_task_warnings reached 0. It will report 5th and 6th tasks because (total_hung_task >= 5). It is better than nothing. But it might be confusing. I am not sure how to fix it. A minimalist solution would be to print a warning. Something like: if (sysctl_hung_task_panic > 1 && (total_hung_task == sysctl_hung_task_panic) && !sysctl_hung_task_warnings) { pr_err("INFO: %d blocked tasks might have been skipped because reached hung_task_warnings limit\n", sysctl_hung_task_panic - 1); Or we could print the "total_hung_task" counter somewhere, for example, pr_err("INFO[%lu]: task %s:%d blocked for more than %ld seconds.\n", total_hung_task, ... Or we could restart the for_each_process_thread() cycle and make sure that all hung tasks will get reported. Or we could ignore it until anyone complains. Best Regards, Petr