Skip to content

Commit df870e1

Browse files
paulmckrcugregkh
authored andcommitted
exit: Sleep at TASK_IDLE when waiting for application core dump
commit b8e7531 upstream. Currently, the coredump_task_exit() function sets the task state to TASK_UNINTERRUPTIBLE|TASK_FREEZABLE, which usually works well. But a combination of large memory and slow (and/or highly contended) mass storage can cause application core dumps to take more than two minutes, which can cause check_hung_task(), which is invoked by check_hung_uninterruptible_tasks(), to produce task-blocked splats. There does not seem to be any reasonable benefit to getting these splats. Furthermore, as Oleg Nesterov points out, TASK_UNINTERRUPTIBLE could be misleading because the task sleeping in coredump_task_exit() really is killable, albeit indirectly. See the check of signal->core_state in prepare_signal() and the check of fatal_signal_pending() in dump_interrupted(), which bypass the normal unkillability of TASK_UNINTERRUPTIBLE, resulting in coredump_finish() invoking wake_up_process() on any threads sleeping in coredump_task_exit(). Therefore, change that TASK_UNINTERRUPTIBLE to TASK_IDLE. Reported-by: Anhad Jai Singh <ffledgling@meta.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Christian Brauner <brauner@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: Chris Mason <clm@fb.com> Cc: Rik van Riel <riel@surriel.com> Cc: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0b8167e commit df870e1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/exit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static void coredump_task_exit(struct task_struct *tsk)
430430
complete(&core_state->startup);
431431

432432
for (;;) {
433-
set_current_state(TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
433+
set_current_state(TASK_IDLE|TASK_FREEZABLE);
434434
if (!self.task) /* see coredump_finish() */
435435
break;
436436
schedule();

0 commit comments

Comments
 (0)