Re: [PATCH RFC exit] Sleep at TASK_IDLE when waiting for application core dump

From: Oleg Nesterov
Date: Thu Jul 25 2024 - 09:31:52 EST


On 07/24, Paul E. McKenney wrote:
>
> 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 triggers "task blocked" splats.

Do you mean check_hung_uninterruptible_tasks() ?

In any case,

> Therefore, change that TASK_UNINTERRUPTIBLE to TASK_IDLE.
...
> @@ -429,7 +429,7 @@ static void coredump_task_exit(struct task_struct *tsk)
> complete(&core_state->startup);
>
> for (;;) {
> - set_current_state(TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
> + set_current_state(TASK_IDLE|TASK_FREEZABLE);

To me this change makes sense regardless...

To some degree TASK_UNINTERRUPTIBLE is misleading, in that the task which
sleeps in coredump_task_exit() is _KILLABLE, although not "directly".

A SIGKILL sent to the coredumping process will interrupt the coredumping thread
(see the signal->core_state check in prepare_signal() and fatal_signal_pending()
check in dump_interrupted()) and then this thread will wakeup the threads sleeping
in coredump_task_exit(), see coredump_finish().

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>