From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CWXP265CU009.outbound.protection.outlook.com (mail-ukwestazon11021078.outbound.protection.outlook.com [52.101.100.78]) (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 7365A1397 for ; Thu, 15 Jan 2026 02:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.100.78 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768444357; cv=fail; b=j+mNSk6245U+HlrQUup9Qiqrf5eq0oUVbHAF3H5PuOMpP/SbXSGZhjebRYsYIt8CS7K4NrPz7CK4OWKKR6YxODdK4ay0EoVtw2U/3XZKCpxXXfKZ4wikzinGcK1/S/eTEqDVUYV6C/QuxIcbki6Ta0jnQicZ/8IFJ1WHRvF4888= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768444357; c=relaxed/simple; bh=VeoIGtrhMgiIDtuuyUjAa3PxKRn1VqCCxLJwJdPKQoc=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=DP7OpipLmnPvkiIFCbSZ32IQL5Cc5fpI4mmELlLxY45Xiyqk70l1La8W0vx8nG2FrRxp0Fs9AOmwnZpRv6kBqh4YmixsbXKyEi/q0zt5/omUdZ5cmfGTn/PHbtlVfOAm0sv8JoUfBXpusNfPEUqHNW8QfQ87vfcqbn8GJdc0Bk0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com; spf=pass smtp.mailfrom=atomlin.com; arc=fail smtp.client-ip=52.101.100.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atomlin.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rvNz2xs/6vdzLZhxEwuHHtwqrI+loEVzRmMcIgJd0tnPGP3zlzSPf5w1EX1cXUEh9euEe0c/vmvHwSRhOgAI2LYTGsRUOw/Zn+MVunzJcC46/ErMNtI0TNiFTQMnVt87jDu6R5pPLxOafhek8IL2lslMg4ENyxtL3gPK0mOKtBT/c6wRBD5ln3JmE7cLAvkDZwcxkMfyzJGQbIyv6KSIkVeh5Mu7b6mTDOfcKfZdnWfhySLV5XFo3iivKNDNk8hH2upkgIf6EUxgpsUsEtAdKF7+bB9Z0ON+8uCdebzLLezj6GMNqgXgcqdvf8dQGdtbTLrUzR0f434h+4sTyXoWcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZZoVNzm97FDXjLU8w7lvOq0He1dNj3Be3Gu3ht1380o=; b=E0m0AenWdqvMc6NbDxKXbUr1N0s6GQ26wrZX7cMJpgWbUYg+c5BzZGDNNic1OxnBld0p+fieWj5Fh7B633QBSLx3PGZLI0fJuq4XAldKdMYE8ycNpA82686snwPjPv3eM4BGSufSIXvjQ7+ZrrYWnyMNVd2CnG0moHgYRmwL8y8dp/1qoxz/Npaj+n9iWMJkuia4K9QjwTzmHHVZ2Wre3GnIcIm1vCWUe3vMoQIUWFlN9f4qF1BZKWT6A4KFtbCKmiZ96PvuZbCTwiXg0p6/Nu9m2s8c6O9KhW6DYzZfUUiO59LLpvOnjCr2wk4MZc8s8xVFYZyvVf91Z3jEZ2iVOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atomlin.com; dmarc=pass action=none header.from=atomlin.com; dkim=pass header.d=atomlin.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=atomlin.com; Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) by CWLP123MB3396.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:6c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9520.6; Thu, 15 Jan 2026 02:32:33 +0000 Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf]) by CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf%5]) with mapi id 15.20.9520.003; Thu, 15 Jan 2026 02:32:33 +0000 From: Aaron Tomlin To: akpm@linux-foundation.org, lance.yang@linux.dev, mhiramat@kernel.org, gregkh@linuxfoundation.org, pmladek@suse.com, joel.granados@kernel.org Cc: sean@ashe.io, linux-kernel@vger.kernel.org Subject: [v6 PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector Date: Wed, 14 Jan 2026 21:32:27 -0500 Message-ID: <20260115023229.3028462-1-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BN9PR03CA0526.namprd03.prod.outlook.com (2603:10b6:408:131::21) To CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLP123MB3523:EE_|CWLP123MB3396:EE_ X-MS-Office365-Filtering-Correlation-Id: 188c97d7-705e-4590-9c72-08de53de560b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1Z9eHP1kLYIzzjxIjI4ul/8ERTSL1ldyg7aSkSIlm4Fq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0dSABUlZm4IorS99isgdTt8+mZadrUYq/1SDbMiQ6Su3p5+UJY9?= =?us-ascii?Q?zQtIU0B1arc2MsRhQ5aRYIFCBpME+7tRTOnexunqp8/7vEL395szALAFBjec?= =?us-ascii?Q?C32oqdx4/LMaA7ptc93ledwQvN9wTM4J5Qo8fSohD4/HJ6mZpjbZv6Y5nwoF?= =?us-ascii?Q?sT1NTYXh9SxpDl/iVYTDchSK9+umnTnSU64oPpFYZ+ZCa9FA9cMnR5TubI7W?= =?us-ascii?Q?8HzfioDoQXijlE97In6qVQLqxt3gu/WYXaPoTsaJrMRD+gd40Gy0PFZ9zxK2?= =?us-ascii?Q?tcHc4ScMxSZilNCg870rocnXdxIPLsc3mGdyFfjQ8vhzh+gpVi/GMjZhwnMQ?= =?us-ascii?Q?2kPQZEY4ELmIX0pv/DyNcqN0GjkChFCivUmXh9aZ0xvZygXx/gpiS+CiGUzM?= =?us-ascii?Q?6xCEjryoH7LDXsssNbBNEHspC4McDL+NFo1M+DB12bqx/lVKNAS1NwbrL59j?= =?us-ascii?Q?x0hUc/l4TUG+GexvmREox/I9Pb/C8OMnLKYJJxItbsWs4NPJLTd4mI0KXHZ8?= =?us-ascii?Q?lXrCGEpxbqMDNkuKgEzy/NL4n/IZPh03O2d6fUp7Fu7h61cZ/vgp4zretU3I?= =?us-ascii?Q?RvXDby1g0AaKwbJSeUiv2JfwjivKsokzyifNlFUbUx0e/Q2CIIMpM7FbEGOV?= =?us-ascii?Q?kxm39drvd0AZwaRcwjg=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A25RU9TKtpTObSdOYyhVYdqebXYC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omlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: 188c97d7-705e-4590-9c72-08de53de560b X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2026 02:32:32.8974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e6a32402-7d7b-4830-9a2b-76945bbbcb57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RBG8VJ6yzIFY/2Tz+ZusoOoXmlSw9bs3Qf/Np4pNM3R3yT/AGKniVgZiy+BPv5rEZCUFxc9JDjDFD5CIsNiB2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP123MB3396 Hi Lance, Greg, Petr, Joel, Andrew, This series introduces the ability to reset /proc/sys/kernel/hung_task_detect_count. Writing a "0" value to this file atomically resets the counter of detected hung tasks. This functionality provides system administrators with the means to clear the cumulative diagnostic history following incident resolution, thereby simplifying subsequent monitoring without necessitating a system restart. The updated logic ensures that the long-running scan (which is inherently preemptible and subject to rcu_lock_break()) does not become desynchronised from the global state. By treating the initial read as a "version snapshot" the kernel can guarantee that the cumulative count only updates if the underlying state remained stable throughout the duration of the scan. Please let me know your thoughts. Changes since v5 [1]: - Introduced a preparatory patch (Joel Granados) - Extended custom proc_handler to handle SYSCTL_USER_TO_KERN writes, strictly validating that only a value of "0" is permitted for resets (Joel Granados) - Transitioned from atomic_long_inc_return_relaxed() to a more robust read_acquire/cmpxchg_release pattern to ensure "All-or-Nothing" scan updates (Petr Mladek) - Re-introduce hung_task_diagnostics(). For better readability and consistent metadata publication Changes since v4 [2]: - Added missing underflow check (Lance Yang) Changes since v3 [3]: - Use atomic operations to ensure cross-CPU visibility and prevent an integer underflow - Use acquire/release semantics for memory ordering (Petr Mladek) - Move quoted string to a single line (Petr Mladek) - Remove variables coredump_msg and disable_msg to simplify code (Petr Mladek) - Add trailing "\n" to all strings to ensure immediate console flushing (Petr Mladek) - Improve the hung task counter documentation (Joel Granados) - Reject non-zero writes with -EINVAL (Joel Granados) - Translate to the new sysctl API (Petr Mladek) Changes since v2 [4]: - Avoided a needless double update to hung_task_detect_count (Lance Yang) - Restored previous use of pr_err() for each message (Greg KH) - Provided a complete descriptive comment for the helper Changes since v1 [5]: - Removed write-only sysfs attribute (Lance Yang) - Modified procfs hung_task_detect_count instead (Lance Yang) - Introduced a custom proc_handler - Updated documentation (Lance Yang) - Added 'static inline' as a hint to eliminate any function call overhead - Removed clutter through encapsulation [1]: https://lore.kernel.org/lkml/20251231004125.2380105-1-atomlin@atomlin.com/ [2]: https://lore.kernel.org/lkml/20251222014210.2032214-1-atomlin@atomlin.com/ [3]: https://lore.kernel.org/all/20251216030036.1822217-1-atomlin@atomlin.com/ [4]: https://lore.kernel.org/lkml/20251211033004.1628875-1-atomlin@atomlin.com/ [5]: https://lore.kernel.org/lkml/20251209041218.1583600-1-atomlin@atomlin.com/ Aaron Tomlin (2): hung_task: Convert detection count to atomic_long_t hung_task: Enable runtime reset of hung_task_detect_count Documentation/admin-guide/sysctl/kernel.rst | 3 +- kernel/hung_task.c | 130 +++++++++++++++----- 2 files changed, 99 insertions(+), 34 deletions(-) -- 2.51.0