diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 04:59:40 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 04:59:40 +0000 |
commit | 4e82adfea5844309159cdde4f2fee53a5512cb5f (patch) | |
tree | 394f8688480631ce897ad138a424635758a1b87f /sys/kern | |
parent | ec0792ca10fd2d28f6a83991ea6499781a146f92 (diff) |
kmem allocation changes for uvm, and vm_fork -> uvm_fork (with one extra argument)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_fork.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index abc8f76d76a..3b5260699ce 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.17 1999/02/23 18:55:09 art Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.18 1999/02/26 04:59:39 art Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -61,6 +61,11 @@ #include <vm/vm.h> #include <vm/vm_kern.h> +#if defined(UVM) +#include <uvm/uvm_extern.h> +#include <uvm/uvm_map.h> +#endif + int nprocs = 1; /* process 0 */ int randompid; /* when set to 1, pid's go random */ pid_t lastpid; @@ -154,8 +159,12 @@ fork1(p1, forktype, rforkflags, retval) #if defined(arc) || defined(mips_cachealias) uaddr = kmem_alloc_upage(kernel_map, USPACE); #else +#if defined(UVM) + uaddr = uvm_km_valloc(kernel_map, USPACE); +#else uaddr = kmem_alloc_pageable(kernel_map, USPACE); #endif +#endif if (uaddr == 0) return ENOMEM; @@ -296,12 +305,14 @@ again: */ p1->p_holdcnt++; +#if !defined(UVM) /* We do this later for UVM */ if (forktype == ISRFORK && (rforkflags & RFMEM)) { /* share as much address space as possible */ (void) vm_map_inherit(&p1->p_vmspace->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS - MAXSSIZ, VM_INHERIT_SHARE); } +#endif p2->p_addr = (struct user *)uaddr; @@ -324,7 +335,11 @@ again: * Finish creating the child process. It will return through a * different path later. */ +#if defined(UVM) + uvm_fork(p1, p2, (forktype == ISRFORK && (rforkflags & RFMEM)) ? TRUE : FALSE); +#else /* UVM */ vm_fork(p1, p2); +#endif /* UVM */ #endif vm = p2->p_vmspace; @@ -358,6 +373,16 @@ again: */ p1->p_holdcnt--; +#if defined(UVM) /* ART_UVM_XXX */ + uvmexp.forks++; +#ifdef notyet + if (rforkflags & FORK_PPWAIT) + uvmexp.forks_ppwait++; +#endif + if (rforkflags & RFMEM) + uvmexp.forks_sharevm++; +#endif + /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our @@ -375,3 +400,4 @@ again: retval[1] = 0; return (0); } + |