[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEK+-Oe8GszRBDDF8jKAmVQNUEvgVqJYDp31P+mZTbqzneEZzA@mail.gmail.com>
Date: Wed, 13 Aug 2025 11:30:36 -0700
From: "Nanji Parmar (he/him)" <nparmar@...estorage.com>
To: akpm@...ux-foundation.org, lance.yang@...ux.dev, mhiramat@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] hung_task: Skip hung task detection during core dump operations
Hi,
This patch fixes false positive hung task warnings during core dump
operations for processes with large memory footprints.
During testing with processes having GBs or >1TB memory, core dump
generation
takes many minutes, causing hung task detector to incorrectly flag threads
as hung. The fix checks for both PF_DUMPCORE and PF_POSTCOREDUMP flags
before reporting tasks as hung.
Tested on the systems with large memory processes.
Best regards,
Nanji
---
>From 45460c6882b602669b25a57f3a2f7ea8a8ea0f84 Mon Sep 17 00:00:00 2001
From: Nanji Parmar <nparmar@...estorage.com>
Date: Wed, 13 Aug 2025 12:14:35 -0600
Subject: [PATCH] hung_task: Exclude core dump tasks from hung task detection
Tasks involved in core dump operations can legitimately block for
extended periods, especially for large memory processes. The hung
task detector should skip tasks with PF_DUMPCORE (main dumping
thread) or PF_POSTCOREDUMP (other threads in the group) flags to
avoid false positive warnings.
This prevents incorrect hung task reports during legitimate core
dump generation that can take xx minutes for large processes.
Signed-off-by: Nanji Parmar <nparmar@...estorage.com>
---
kernel/hung_task.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 8708a1205f82..0fc3352d0f0e 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -217,6 +217,13 @@ static void check_hung_task(struct task_struct *t,
unsigned long timeout)
*/
sysctl_hung_task_detect_count++;
+ /* Skip hung task detection for tasks involved in core dump
operations */
+ if (t->flags & (PF_DUMPCORE | PF_POSTCOREDUMP)) {
+ pr_info("Skipping hung task check for coredump-related task
%s:%d (blocked %ld seconds)\n",
+ t->comm, t->pid, (jiffies - t->last_switch_time) /
HZ);
+ return;
+ }
+
trace_sched_process_hang(t);
if (sysctl_hung_task_panic) {
--
2.50.1
Content of type "text/html" skipped
Download attachment "hung_task_fix.patch" of type "application/octet-stream" (1434 bytes)
Powered by blists - more mailing lists