summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2007-11-02 19:40:36 +0000
committerjulian <julian@FreeBSD.org>2007-11-02 19:40:36 +0000
commit0bf0ae3b24810072f6313df54fe1bf99d2feb341 (patch)
tree97c50ba4e94c1ef72e6c4c9b7d44332b208c2c2b /sys/kern/kern_fork.c
parent2fb801fb7bf5023ddd73916fce845be604ba27aa (diff)
downloadFreeBSD-src-0bf0ae3b24810072f6313df54fe1bf99d2feb341.zip
FreeBSD-src-0bf0ae3b24810072f6313df54fe1bf99d2feb341.tar.gz
Completely remove the code for single threading the mainline fork code.
Put in a little comment explaining why it went away. Re-enable it in the case there an exisiting process is just splitting off its address space and file descriptors. (I donpt think anything uses that code but it needs some sort of locking and this does the job. Reviewed by: Davidxu, alc, others MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c52
1 files changed, 3 insertions, 49 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 52f68f0..917de57 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -208,7 +208,6 @@ fork1(td, flags, pages, procp)
* certain parts of a process from itself.
*/
if ((flags & RFPROC) == 0) {
-#if 0 /* XXX no other OS tries to do this */
if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) &&
(flags & (RFCFDG | RFFDG))) {
PROC_LOCK(p1);
@@ -218,7 +217,6 @@ fork1(td, flags, pages, procp)
}
PROC_UNLOCK(p1);
}
-#endif
vm_forkproc(td, NULL, NULL, flags);
@@ -238,49 +236,21 @@ fork1(td, flags, pages, procp)
if (flags & RFFDG)
fdunshare(p1, td);
-#if 0 /* XXX no other OS tries to do this */
if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) &&
(flags & (RFCFDG | RFFDG))) {
PROC_LOCK(p1);
thread_single_end();
PROC_UNLOCK(p1);
}
-#endif
*procp = NULL;
return (0);
}
-#if 0 /* XXX no other OS tries to do this */
/*
- * Note 1:1 allows for forking with one thread coming out on the
- * other side with the expectation that the process is about to
- * exec.
+ * XXX
+ * We did have single-threading code here
+ * however it proved un-needed and caused problems
*/
- if ((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) {
- /*
- * Systems processes don't need this.
- * Idle the other threads for a second.
- * Since the user space is copied, it must remain stable.
- * In addition, all threads (from the user perspective)
- * need to either be suspended or in the kernel,
- * where they will try restart in the parent and will
- * be aborted in the child.
- * keep threadds at the boundary there.
- */
- PROC_LOCK(p1);
- if (thread_single(SINGLE_BOUNDARY)) {
- /* Abort. Someone else is single threading before us. */
- PROC_UNLOCK(p1);
- return (ERESTART);
- }
- PROC_UNLOCK(p1);
- /*
- * All other activity in this process
- * is now suspended at the user boundary,
- * (or other safe places if we think of any).
- */
- }
-#endif
/* Allocate new proc. */
newproc = uma_zalloc(proc_zone, M_WAITOK);
@@ -729,17 +699,6 @@ again:
msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0);
PROC_UNLOCK(p2);
-#if 0 /* XXX no other OS tries to do this */
- /*
- * If other threads are waiting, let them continue now.
- */
- if ((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) {
- PROC_LOCK(p1);
- thread_single_end();
- PROC_UNLOCK(p1);
- }
-
-#endif
/*
* Return child proc pointer to parent.
*/
@@ -755,11 +714,6 @@ fail:
mac_proc_destroy(newproc);
#endif
uma_zfree(proc_zone, newproc);
- if (p1->p_flag & P_HADTHREADS) {
- PROC_LOCK(p1);
- thread_single_end();
- PROC_UNLOCK(p1);
- }
pause("fork", hz / 2);
return (error);
}
OpenPOWER on IntegriCloud