From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from LO3P265CU004.outbound.protection.outlook.com (mail-uksouthazon11020115.outbound.protection.outlook.com [52.101.196.115]) (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 E89F23D411A for ; Tue, 4 Aug 2026 15:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.196.115 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785858855; cv=fail; b=nMuzlm2fC58X61iWTmU15lGpoDzyeWYL/qClIlnNgs3LP5+2H97itU9JkoXOvewrV/mGo1/aqYfAJXuS/ibRnpcxZBlco/2gb+WbZisupIiJjFgRZvm5WehsNCQaKtcwDe3vX6RLr1r1hQWjj+ufDnHwcCRd+ahvuKzP6pgBo5Y= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785858855; c=relaxed/simple; bh=OJ/yWzLFG9WaHqTBmv3NXPkW5ECvCIybUvPyJzxZZcc=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Gksk6SdJYNHBIS3LGU+1Zd03xVKYLi6yZp0pn7S04Eg24mFcVLp8AUVItwVdU39s723sx2OCej0Phgql3mK+u7zn3RXbhMioz8IrIbSqsTwWxr0w7uBaLoF4VbSmvOizO3b6tIhc/yWlt2rHDlkmr+Rrti9QTWjN6NOWJPLJwv0= 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.196.115 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=W68GZM7wdegAirB5uAVcbAeRuaV8/zIiTg2wLDfS79IFGo1Orpy53ZhkZiFnq285Rn0DOVpJYFuFdZcRwjotInIZcuYmEMD1e5WZ7ej4RCQnY0x0LTgbTKFJeUcJfHnPG7bXaFq/5oHU/zYrW3cRWEKHJFgIo0XiVPt62aojx4Zdp1RpRnDDeX4aHTOrHuTrfs/wtM6o3fodM5nhwrWb9wLoTf+UABlLRZqF788POMHM1kbRNhXdU/+fxmC91f6ykUeLVs3zka2Xyxrx2cf8HykkyjuryXfcKgxBnDmHO0U0DDuFqgjMArR1dt4QjR4/KwX2UfXIlJRwUTX56QsNXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:MIME-Version; bh=BM1wVNJZZ7BCEQobwwSc99JAUfGnjs2y1CzcSNqeBdo=; b=qqn+gTtsx10EFNauEc8oNboLhskDw6bfQ2mWW4g9lpx31JoDKYbxayhzl8TlBsiu13k/zujlSoTyMo7jCebV4t7f1Obx5JHCE8SgKkTWGwFUNClhoWo3Ay3RN9dZPcMqIrn0aCB2zPtN3fQ+7ppzJSIkqLHXNyzumvbgUY+nmnEn6IsCXA9nB6HNUTJlfEnFTmDwAIw1na7huARqlCb9RRusB5KVQM4KbkOywfBa5nJaASSqKfVBpMfKSkFp++1bFp3JQZKmC4eTfG+HokDqR9LcjXMt/gq9CnerMy4NjC96HeolR0LvS5tzdhRsBRuZyThAOd6HnvVZRLsoS4TeqA== 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 CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:183::5) by LO2P123MB3919.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:146::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.292.15; Tue, 4 Aug 2026 15:54:10 +0000 Received: from CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM ([fe80::cec4:77ab:262e:d230]) by CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM ([fe80::cec4:77ab:262e:d230%4]) with mapi id 15.21.0292.013; Tue, 4 Aug 2026 15:54:10 +0000 From: Aaron Tomlin To: akpm@linux-foundation.org, lance.yang@linux.dev, mhiramat@kernel.org, pmladek@suse.com Cc: linux-kernel@vger.kernel.org, david.laight.linux@gmail.com, atomlin@atomlin.com, neelx@suse.com, sean@ashe.io, chjohnst@gmail.com, steve@abita.co, mproche@gmail.com, nick.lange@gmail.com Subject: [PATCH v7 0/2] hung_task: Improve warning budget handling and task reporting Date: Tue, 4 Aug 2026 11:54:04 -0400 Message-ID: <20260804155406.254810-1-atomlin@atomlin.com> X-Mailer: git-send-email 2.55.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MN0P221CA0026.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:52a::14) To CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:183::5) 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: CWLP123MB6607:EE_|LO2P123MB3919:EE_ X-MS-Office365-Filtering-Correlation-Id: f3900e34-ae60-4438-c459-08def2409f58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|7416014|366016|376014|1800799024|6133799003|56012099006|10067099003|18002099003|3023799007; X-Microsoft-Antispam-Message-Info: cosEq0aIBtsVB2VKOqqxKZ1lBAawlUJGd8bG5q1VuivooVycOTI5NkH2T7gmCLazPDf7XHPOTTDK7BMIsOGv3LHJfsYfvZZD645LNKJi8ftZTHWa1upKqv+5KHPNb2ka9QZ0cjOE4IdsVxCiCekAdEshHbzJ91XYJcUz+QxQmbK0zjIzikdhIFdrdKl3WwMUBLOKuAfAS5rFx5+yYE5h84H7H7cWh+G2E2PM1LDWH7/UDoXKZ+EDpFprblnbWjNcWHFlWogf/Oom4B/Q4soaF7fv+jj7LJIJ9IzHR8YhFuCzNYQYT4j8i1gvs4xhD8E+ncrhsvhFb97tpZzRetjRgVwq1tvawDtiF6y+ieyUlZFYDaL18Dug/W4zY4TojvyiVkqTVEar5SGAsCpczaWepD8MLOcTA99soHcgIy6raxstZRGZkUMBcxGnk4QhXasVzafMcBwh6QcxQv1hNENxjwvoGTyx9lS5PcFDBx+7mcvABY19/1LByrEepQpxLq+s8mlNSLWFqTwjeCiB6gVoJ8Md5YL96gnj9XEybOS+TVPfWYehQFX3SCxNE4TkKjm2EFbTUeYytb12e0S+cLgFAioBWDdskkK6aktXQsjpT5AubrfMTgOpmgQwdZLWemHHM4xq7MBJC32SInQdJBHz5oh0S5wN21rU7IxdSudnRuo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(366016)(376014)(1800799024)(6133799003)(56012099006)(10067099003)(18002099003)(3023799007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?t53dm5/nSJVdM+W4avCRCPKIUlvvsUMo6u7XkKE/ghC9juk4g8GcYrBb4yE8?= =?us-ascii?Q?+b/GZPZxXi/zNAqLmURkaPetc8tVLy0T329hnm/a4OehR0M1RNhV4VnK8Ehj?= =?us-ascii?Q?HPL/+nRv21IqeSZDf8gRskdst3yLNS3aIPjE7QnHxiU1d0u53O5b5JKaFHMF?= =?us-ascii?Q?WIZjVxxz88cyldQoqgBB76c0u7/A99EW0uzylOl+brjwdwCq5gXNENAILYjX?= =?us-ascii?Q?xQvY2LjAtjztgLf2UiWwlSsH9VdjznB5jBrlICPRlO2mjNja+vcwToiZOqYM?= =?us-ascii?Q?docykeAwHlRtSTgdwn7csXGniulHLu+YzrEqiu0OQRWRPlzC9i8+52wtBM3z?= =?us-ascii?Q?0ryepUpLdypDCLHRZgw8CeWw45dKBhTP0W30mrb4auqGP5Xwqc3Pn7uGOqE4?= =?us-ascii?Q?+H057ITHCpVE+phHFyCThvRqQSt7KKSMM5W06ZmCbruYSe6HgTiwu7MVOKJg?= =?us-ascii?Q?siA4ShM1cE+tQ6S/TKaxUfi8XCwsSF/QyMUgWWvwQf22PilyNVeu2IdpWiT2?= =?us-ascii?Q?898EUSa1Fhxf2G/94g62c72ycgzNeN+wjsWhSrqLTcxnbL7748h/VSairo+9?= =?us-ascii?Q?/TXOyHX4mbCj2XVDe5XCJUniUY2ygPJbV8uHNS3Ak3Cej4Wbi0t2/b8w17b9?= =?us-ascii?Q?axs9g5kqL02C+ZwXFwThaeiqvln1TCykshAdwL93EhFrOLRcXHUSA0mm7Acw?= =?us-ascii?Q?NljQxkk56VkkyM6E3MuHsC3+/Ae4LzsdV0nuAw7Qxx5qyvf4rNXVZtZfe97l?= =?us-ascii?Q?jDmteNNnitjx3+vwQaPVz6hHx39sxL1iApl9xxnCcKCkclMiRdmtRyslp3B9?= =?us-ascii?Q?KTaZcM+ggoqR+c0dPnB65ApYgQIzWLbK7HxvhMy6LGDP62kGoro8hx56WhFl?= =?us-ascii?Q?B88QzR0wIrUX1uTgWEN0Dp8W2S0pd7gRYlOZFEukLYMMo6YHeExHinn1S+AL?= =?us-ascii?Q?0s5+P+Kn/3Ko25NUKht6XgFrfEa2Xwq965wZpD+1AwGoe0tlPkc+2UTLrjRr?= =?us-ascii?Q?exxFIGRJbh5SfvLEtXGpzffril6vqeuysmT+cnZHxOv/BeMrKg+ahO9+MVaq?= =?us-ascii?Q?4Ny0HqBaLQ55l8WNpulOA+fwrQsmDwFgdy+0a1XfR4EMtLDDdUr23HFUmVbE?= =?us-ascii?Q?LrRANtviaPMwpzW5Az4HZD5jidch0j9M9p04S6oO+tkF7YBQCcA2e+l8+vZC?= =?us-ascii?Q?XOxSuvyhGsSCopuYrddKqqOPsGrxK24eKeZYMNIK6U9faT9cO+JHAvv23DXE?= =?us-ascii?Q?+U0UYzw8I7PVDlJ0Wzs5a7bJjc434pmY/FqLpOB0lChp5G5Akc5kcYr7VF8S?= =?us-ascii?Q?xgamftpv4BOeW80k0EqHbH7p0iOq6WBZq2Drrj7xDnq4I1eNs35U3XphcGK+?= =?us-ascii?Q?lshJNg/DrOgbwnp4Vjb1MylztkL1z4VSsniDHQeSWzSBsrhz2Zj6UaDmSwHG?= =?us-ascii?Q?0J1ydMUy5NlmsKpjJVr9+AjBrl5CZQjW6HgC4ZTeS2H49612w6MUpnEI4bvB?= =?us-ascii?Q?cRQzxIlS74jb9/GydeA/Mj4S6iSewO/pQDIFu9GMJgAC6zAsRwtJ+iMxNkXz?= =?us-ascii?Q?XAiXtxqzRCiXJNqOsanCSSg3h1IrwbAtzoSQHfMpZoKyeN3ZB7AHTJPrL8Af?= =?us-ascii?Q?W4L/PA3enQZhx6rSZwxluN3sbq3X26h8zwLOHS9lMCrWzu8XBDnOprCzNezF?= =?us-ascii?Q?0wFqs3GeOlXubL+yJYatmmalTqhoXn+D1G+56yXaHLUQ7e6+DFTJP+e8bLqW?= =?us-ascii?Q?dagcH5Da9Q=3D=3D?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3900e34-ae60-4438-c459-08def2409f58 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB6607.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2026 15:54:10.0654 (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: axj7wNfAvSggMrKeXR1cePdJYvztXGkkz4RLtxi8NEDXlDaohLyNabDd77D1N0/jwEHShSB+FYPgDbeAt1WU6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO2P123MB3919 The hung_task watchdog detects tasks stuck in uninterruptible (D) state for longer than CONFIG_DEFAULT_HUNG_TASK_TIMEOUT seconds. To prevent log spam during system spikes, sysctl_hung_task_warnings enforces a budget on the number of logged warnings. However, the current implementation has two major limitations: 1. Permanent exhaustion of warning budget sysctl_hung_task_warnings is decremented directly when printing warnings. Once this budget hits zero, no further warnings are reported until an administrator manually updates the sysctl value or reboots the system. Consequently, a single temporary hang episode permanently blinds the kernel watchdog to any subsequent hung tasks after system recovery. 2. Total log suppression when budget is exhausted Once the warning budget reaches zero, hung_task_info() completely suppresses all output, including the basic single-line alert. While suppressing verbose stack dumps and lock debugging is desirable to prevent dmesg flooding, hiding basic task alerts leaves administrators entirely unaware that tasks are hanging. This patch series resolves both limitations by decoupling the configured warning budget from the runtime warning counter, automatically resetting the budget when the system recovers, and keeping basic single-line hung task alerts visible. Patch 1 decouples the user-configured limit sysctl_hung_task_warnings from the runtime counter hung_task_warnings_printed, automatically resetting hung_task_warnings_printed back to the configured limit whenever a check interval passes with zero hung tasks detected. The runtime counter is also kept synchronized whenever the sysctl parameter is modified, and the corresponding sysctl documentation (Documentation/admin-guide/sysctl/kernel.rst) is updated to reflect this auto-reset behaviour. Patch 2 ensures that the basic single-line pr_err("INFO: task %s:%d blocked...") header is always logged regardless of warning budget exhaustion, while restricting warning budget enforcement solely to verbose diagnostics such as process stack dumps, taint and release information, and lock blocker details. Additionally, it updates the warning exhaustion log message to clarify to administrators that future reports will only omit detailed process dumps rather than being completely suppressed. Changes since v6: - Refined the description of sysctl hung_task_warnings (Lance Yang) - Linked to v6: https://lore.kernel.org/lkml/20260719161305.428947-1-atomlin@atomlin.com/ Changes since v5: - Skipped hung_task_info() and sys_info() for tasks already reported in previous rounds to avoid log spam - Linked to v5: https://lore.kernel.org/lkml/20260712202100.123934-1-atomlin@atomlin.com/ Changes since v4: - Replaced the stack-local hashmap implementation with a persistent array (Petr Mladek) - Persistently track blocker addresses across scan intervals. Suppress warning reports and keep the sysctl_hung_task_warnings budget intact if the blocker is already tracked in the array (Petr Mladek) - Reset the warnings budget and clear the blocker array when the hang resolves (Petr Mladek) - Output a recovery message to the kernel ring buffer upon hang resolution - Linked to v4: https://lore.kernel.org/lkml/20260627205733.90983-1-atomlin@atomlin.com/ Changes since v3: - Deduct from the global budget if printing a full stack trace - Pivoted from heuristic Wait Channel hashing to deterministic blocker address hashing via CONFIG_DETECT_HUNG_TASK_BLOCKER - Replaced the hung_task_reported bit-field with a standalone u8 byte. Move hung_task_reported into an existing structural alignment hole within task_struct following blocked_lock, resulting in zero overall memory footprint increase and optimal cacheline grouping - Linked to v3: https://lore.kernel.org/lkml/20260621213756.43225-1-atomlin@atomlin.com/ Changes since v2: - Replaced the per-round cache flush with a task_struct bit-field for persistent cross-scan tracking, mitigating delayed budget exhaustion - Abandoned exact-stack hashing in favour of Wait Channel hashing - Transitioned from jhash() to hash_long() to optimise single-pointer hashing, and relocated the hash map to the local stack - Linked to v2: https://lore.kernel.org/lkml/20260620013559.1537893-1-atomlin@atomlin.com/ Changes since v1: - Preserve "INFO:" headers for all hung tasks; suppress only the stack dumps for duplicates (Masami Hiramatsu) - Print a clear notification when a trace is explicitly suppressed - Add #ifdef CONFIG_STACKTRACE guards to prevent Kconfig build errors - Optimise overhead by unwinding the stack only if a warning is actually going to be printed - Linked to v1: https://lore.kernel.org/lkml/20260617184841.1447955-1-atomlin@atomlin.com/ Petr Mladek (2): hung_task: Reset warning budget when problem gets resolved hung_task: Always print basic hung task info header Documentation/admin-guide/sysctl/kernel.rst | 5 ++- kernel/hung_task.c | 46 +++++++++++++++------ 2 files changed, 37 insertions(+), 14 deletions(-) -- 2.55.0