From: Dave McCracken <dmccr@us.ibm.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.4] Thread group exit problem reappeared.
Date: Thu, 09 May 2002 14:27:00 -0500 [thread overview]
Message-ID: <43390000.1020972420@baldur.austin.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
A long time ago there was thread group code that at exit time tried to
reparent a task to another task in the thread group. I discovered a major
race condition in this code, and submitted a patch that removed it. This
patch was accepted in, I thin, 2.4.12. The code reappeared in 2.4.18,
breaking applications that use thread groups.
As part of chasing this down, I figured out a way to remove the race
condition while still preserving this behavior. I've attached a patch
against 2.4.19-pre8 that fixes it.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
dmccr@us.ibm.com T/L 678-3059
[-- Attachment #2: exit-2.4.19-pre8.diff --]
[-- Type: text/plain, Size: 797 bytes --]
--- linux-2.4.19-pre8/./kernel/exit.c Tue May 7 09:18:14 2002
+++ linux-2.4.19-pre8-reparent/./kernel/exit.c Tue May 7 10:01:56 2002
@@ -152,7 +152,7 @@
/*
* When we die, we re-parent all our children.
- * Try to give them to another thread in our process
+ * Try to give them to another thread in our thread
* group, and if no such member exists, give it to
* the global child reaper process (ie "init")
*/
@@ -162,8 +162,14 @@
read_lock(&tasklist_lock);
- /* Next in our thread group */
- reaper = next_thread(father);
+ /* Next in our thread group, if they're not already exiting */
+ reaper = father;
+ do {
+ reaper = next_thread(reaper);
+ if (!(reaper->flags & PF_EXITING))
+ break;
+ } while (reaper != father);
+
if (reaper == father)
reaper = child_reaper;
reply other threads:[~2002-05-09 19:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43390000.1020972420@baldur.austin.ibm.com \
--to=dmccr@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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
all inboxes | Powered by JetHome®