Re: Process with many NPTL threads terminates slowly on core dump signal

From: Oleg Nesterov
Date: Wed Oct 12 2005 - 12:21:31 EST

Michael Kerrisk wrote:
> Following up (belatedly) from my earlier message, I took Daniel
> Jacobowitz's suggestion to investigate the result from booting
> with "profile=2". When running my program (shwon below) on
> 2.6.14-rc4 to create 100 threads, and sending a core dump signal,
> the program takes 90 seconds to terminate, and readprofile shows
> the following:

I think the coredumping code in __group_complete_signal() is bogus
and what happens is:

group_send_sig_info(P, SIGQUIT):

adds SIGQUIT to ->shared_pending


->signal->group_exit_task = P;

for_each_thread(t) {
P->signal->group_stop_count ++;

Now, P receives the signal:


if (->signal->group_stop_count > 0) // YES
if (->signal->group_exit_task == current) { // YES
->signal->group_exit_task = NULL
return 0;

signr = dequeue_signal(); // SIGQUIT


->signal->flags = SIGNAL_GROUP_EXIT;



Now all other threads do:


if (->signal->group_stop_count > 0) // YES
if (->signal->flags & SIGNAL_GROUP_EXIT) // YES
return 0;

signr = dequeue_signal(); // no pending signals
// recalc_sigpending_tsk() DOES NOT clear TIF_SIGPENDING,
// because it sees ->group_stop_count != 0.

return 0;

TIF_SIGPENDING is not cleared, so get_signal_to_deliver() will be
called again on return to userspace. When all threads will eat their
->time_slice, P will return from yield() and kill all threads.

Could you try this patch (added to mm tree):
? It does not solve the whole problem, but may help.

Please report the result, if possible.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at