public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave McCracken <dmccr@us.ibm.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Separate CLONE_PARENT and CLONE_THREAD behavior
Date: Wed, 24 Oct 2001 14:16:55 -0500	[thread overview]
Message-ID: <117830000.1003951015@baldur> (raw)


Several versions back you added code that forces CLONE_PARENT behavior
whenever CLONE_THREAD is specified.  This unnecesarily forces a particular
multi-threading model at the application level, and in fact breaks some
ways of doing multi-threading.

In particular, it requires that at least one task in an application *not*
be part of the thread group, and that the pid returned by the original
fork() can not be the thread group id itself.

It would still be entirely possible to code an application or threading
library in the way you envision by specifying CLONE_PARENT and CLONE_THREAD
together.  However, there's no good reason for forcing this model.

A patch to remove that restriction is below.

Dave McCracken

======================================================================
Dave McCracken          IBM Linux Base Kernel Team      1-512-838-3059
dmccr@us.ibm.com                                        T/L   678-3059

----------

--- linux-2.4.13/kernel/fork.c	Tue Oct 23 19:44:15 2001
+++ linux-2.4.13-signal/kernel/fork.c	Wed Oct 24 11:46:09 2001
@@ -700,10 +721,10 @@
 	/* Need tasklist lock for parent etc handling! */
 	write_lock_irq(&tasklist_lock);
 
-	/* CLONE_PARENT and CLONE_THREAD re-use the old parent */
+	/* CLONE_PARENT re-uses the old parent */
 	p->p_opptr = current->p_opptr;
 	p->p_pptr = current->p_pptr;
-	if (!(clone_flags & (CLONE_PARENT | CLONE_THREAD))) {
+	if (!(clone_flags & CLONE_PARENT)) {
 		p->p_opptr = current;
 		if (!(p->ptrace & PT_PTRACED))
 			p->p_pptr = current;


             reply	other threads:[~2001-10-24 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-24 19:16 Dave McCracken [this message]
2001-10-25  0:10 ` [PATCH] Separate CLONE_PARENT and CLONE_THREAD behavior J . A . Magallon
2001-10-25 13:24   ` Dave McCracken

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=117830000.1003951015@baldur \
    --to=dmccr@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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