From: Oleg Nesterov <oleg@tv-sign.ru>
To: Michael Kerrisk <mtk-lkml@gmx.net>
Cc: Daniel Jacobowitz <dan@debian.org>,
Roland McGrath <roland@redhat.com>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: Process with many NPTL threads terminates slowly on core dump signal
Date: Wed, 12 Oct 2005 21:33:46 +0400 [thread overview]
Message-ID: <434D48FA.FD0439AA@tv-sign.ru> (raw)
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
__group_complete_signal:
->signal->group_exit_task = P;
for_each_thread(t) {
P->signal->group_stop_count ++;
// sets TIF_SIGPENDING
signal_wake_up(t)
}
Now, P receives the signal:
get_signal_to_deliver:
if (->signal->group_stop_count > 0) // YES
handle_group_stop():
if (->signal->group_exit_task == current) { // YES
->signal->group_exit_task = NULL
return 0;
}
signr = dequeue_signal(); // SIGQUIT
do_coredump:
->signal->flags = SIGNAL_GROUP_EXIT;
coredump_wait:
yield();
Now all other threads do:
get_signal_to_deliver:
if (->signal->group_stop_count > 0) // YES
handle_group_stop();
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):
http://marc.theaimsgroup.com/?l=linux-kernel&m=112887453531139
? It does not solve the whole problem, but may help.
Please report the result, if possible.
Oleg.
next reply other threads:[~2005-10-12 17:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-12 17:33 Oleg Nesterov [this message]
2005-10-13 8:41 ` Process with many NPTL threads terminates slowly on core dump signal Michael Kerrisk
2005-10-13 17:18 ` Oleg Nesterov
-- strict thread matches above, loose matches on Subject: below --
2005-09-22 12:13 Michael Kerrisk
2005-09-22 13:10 ` Michael Kerrisk
2005-09-24 15:28 ` Daniel Jacobowitz
2005-10-12 13:34 ` Michael Kerrisk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=434D48FA.FD0439AA@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=dan@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtk-lkml@gmx.net \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).