diff options
author | John Dyson <dyson@FreeBSD.org> | 1997-04-13 01:48:35 +0000 |
---|---|---|
committer | John Dyson <dyson@FreeBSD.org> | 1997-04-13 01:48:35 +0000 |
commit | 5856e12e6950cdbbf627ab23ddc0d10006d8dd75 (patch) | |
tree | bddd380f285bf7d3a8f4c326934ea585723eec61 /sys/vm/vm_glue.c | |
parent | 4ff323dd450fa95949901235c99189a25477521d (diff) | |
download | src-5856e12e6950cdbbf627ab23ddc0d10006d8dd75.tar.gz src-5856e12e6950cdbbf627ab23ddc0d10006d8dd75.zip |
Fully implement vfork. Vfork is now much much faster than even our
fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)
Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
from the other threads of a group.
Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
possible existing shares with other threads/processes.
Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
thread from the rest of the group.
Fix the case where a thread does an exec. It is almost nonsense for a thread
to modify the other threads address space by an exec, so we
now automatically divorce the address space before modifying it.
Notes
Notes:
svn path=/head/; revision=24848
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r-- | sys/vm/vm_glue.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 2116a0e35d77..b49b25ffba58 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -59,7 +59,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_glue.c,v 1.61 1997/02/22 09:48:17 peter Exp $ + * $Id: vm_glue.c,v 1.62 1997/04/07 07:16:04 peter Exp $ */ #include "opt_rlimit.h" @@ -211,14 +211,16 @@ vm_fork(p1, p2, flags) pmap_t pvp; vm_object_t upobj; + if (flags & RFMEM) { + p2->p_vmspace = p1->p_vmspace; + p1->p_vmspace->vm_refcnt++; + } + while ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min) { VM_WAIT; } - if (flags & RFMEM) { - p2->p_vmspace = p1->p_vmspace; - p1->p_vmspace->vm_refcnt++; - } else { + if ((flags & RFMEM) == 0) { p2->p_vmspace = vmspace_fork(p1->p_vmspace); if (p1->p_vmspace->vm_shm) |