summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
AgeCommit message (Collapse)Author
2002-10-31Defer pid allocation and making the new process visible until after it'sArtur Grabowski
been fully initialized. Otherwise the scheduler and other things can accidentally stumble into semi-initialized processes and strange things can happen. This also requires us to do systrace attachment a bit later. Debugging help from fgs@
2002-10-22Remove a part that did sneak in that wasn't meant to be commited yet.Artur Grabowski
2002-10-21ANSIArtur Grabowski
2002-10-21Two problems.Artur Grabowski
First we check for running out of processes (nprocs variable) before we continue with the fork, then we do various calls that might sleep (and allow other forks to start and pass that check), then we increase that variable. This could allow processes to be created past the limit. Second is that we don't decrease the the process count for this uid if the stack allocation fails. So a user could run out of processes he's allowed to run without actually having them. miod@ ok
2002-05-16systrace facility, used to enforce and generate policies for system callsNiels Provos
okay deraadt@
2002-03-14First round of __P removal in sysTodd C. Miller
2002-02-22Fix stack sharing in FORK_VMNOSTACK.Artur Grabowski
Don't assume that the stack is on the top of user address space. And don't assume that the stack grows down.
2002-02-16Simplify pid selection algorithm. ok art@ deraadt@Thomas Nordin
2002-02-14No more RFORK_FDSAHRE option, always allow FORK_SHAREFILES.Artur Grabowski
2002-02-05Workaround for VM_MAXUSER_ADDRESS not being page aligned on sparc64.Artur Grabowski
2002-01-25poolify pcreds.Artur Grabowski
2002-01-16Don't include <sys/map.h> when you don't need what's in it.Miod Vallat
2001-11-06Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.Miod Vallat
(Look ma, I might have broken the tree)
2001-11-06Let fork1, uvm_fork, and cpu_fork take a function/argument pair as argument,Artur Grabowski
instead of doing fork1, cpu_set_kpc. This lets us retire cpu_set_kpc and avoid a multiprocessor race. This commit breaks vax because it doesn't look like any other arch, someone working on vax might want to look at this and try to adapt the code to be more like the rest of the world. Idea and uvm parts from NetBSD.
2001-11-06More sync to NetBSD.Artur Grabowski
- Use malloc/free instead of MALLOC/FREE for variable sized allocations. - Move the memory inheritance code to sys/mman.h and rename from VM_* to MAP_* - various cleanups and simplifications.
2001-10-14Disable fd sharing for this release. Sorry.Artur Grabowski
deraadt@ ok.
2001-09-19merge vm/vm_kern.h into uvm/uvm_extern.h; art@ okMichael Shalayeff
2001-06-27no more fork braindamageArtur Grabowski
2001-06-27mips_cachealias is no moreArtur Grabowski
2001-06-27remove old vmArtur Grabowski
2001-04-02On popular demand, the Linux-compatibility clone(2) implementation basedNiklas Hallqvist
on NetBSD's code, as well as some faked Posix RT extensions by me. This makes at least simple linuxthreads tests work.
2001-03-23Use pool to allocate processes.Artur Grabowski
2001-02-13More sane spl handling. Don't just assume that we're called at spl0.Artur Grabowski
2000-11-16support kernel event queues, from FreeBSD by Jonathan Lemon,Niels Provos
okay art@, millert@
2000-11-09PHOLD/PRELE instead manual fiddling with p_holdcntArtur Grabowski
2000-07-10last change was not tested on VM systemsTheo de Raadt
2000-07-07The rfork sharing of vmspace is .. special and was broken with UVM.Artur Grabowski
Add a new flag to fork1 - FORK_VMNOSTACK that shares all of the vmspace except the stack and use it for rfork.
2000-06-18Mark kernel threads as system processes. Make ps hide them by default,Niklas Hallqvist
show them with -k. Do not try to show RSS based values for them as they mess up column alignment. vmstat -f now shows kernel threads separately from rforks too.
2000-03-23Don't reinitialize the tsleep and ITIMER_REAL timers all the time.Artur Grabowski
The function and the argument never change.
2000-03-03Use the LIST_FIRST macro to get the head of zombproc list.Artur Grabowski
2000-03-03Use LIST_ macros instead of internal field names to walk the allproc list.Artur Grabowski
2000-02-21dead code and symbol pollution.Artur Grabowski
2000-01-31re-add fixed vfork code from artTheo de Raadt
2000-01-31undo vfork changes, since non-UVM was not consideredTheo de Raadt
2000-01-28Change fork1() from taking forktype and rforkflags, into a single flagsArtur Grabowski
argument. Let sys_rfork build the arguments to fork1() and do the sanity checks itself.
1999-08-17New cpu_fork API to take a stack in which you point the child's stackpointerNiklas Hallqvist
to, at the bottom or the top, depending on your architecture's stack growth direction. This is in preparation for Linux' clone(2) emulation. port maintainers, please check that I did the work right.
1999-08-15Adopt NetBSD fix for scheduler problems (nice was broken). From the NetBSDPaul Janzen
commit messages: Scheduler bug fixes and reorganization * fix the ancient nice(1) bug, where nice +20 processes incorrectly steal 10 - 20% of the CPU, (or even more depending on load average) * provide a new schedclock() mechanism at a new clock at schedhz, so high platform hz values don't cause nice +0 processes to look like they are niced * change the algorithm slightly, and reorganize the code a lot * fix percent-CPU calculation bugs, and eliminate some no-op code === nice bug === Correctly divide the scheduler queues between niced and compute-bound processes. The current nice weight of two (sort of, see `algorithm change' below) neatly divides the USRPRI queues in half; this should have been used to clip p_estcpu, instead of UCHAR_MAX. Besides being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op, and it was done after decay_cpu() which can only _reduce_ the value. It has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can scheduler-penalize themselves onto the same queue as nice +20 processes. (Or even a higher one.) === New schedclock() mechanism === Some platforms should be cutting down stathz before hitting the scheduler, since the scheduler algorithm only works right in the vicinity of 64 Hz. Rather than prescale hz, then scale back and forth by 4 every time p_estcpu is touched (each occurance an abstraction violation), use p_estcpu without scaling and require schedhz to be generated directly at the right frequency. Use a default stathz (well, actually, profhz) / 4, so nothing changes unless a platform defines schedhz and a new clock. [ To do: Define these for alpha, where hz==1024, and nice was totally broke.] === Algorithm change === The nice value used to be added to the exponentially-decayed scheduler history value p_estcpu, in _addition_ to be incorporated directly (with greater weight) into the priority calculation. At first glance, it appears to be a pointless increase of 1/8 the nice effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that because it will ramp up linearly but be decayed only exponentially, thus converging to an additional .75 nice for a loadaverage of one. I killed this: it makes the behavior hard to control, almost impossible to analyze, and the effect (~~nothing at for the first second, then somewhat increased niceness after three seconds or more, depending on load average) pointless. === Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation. Collect scheduler functionality. Try to put each abstraction in just one place.
1999-07-17correct fork statistics for UVMArtur Grabowski
1999-07-15vm_offset_t -> {v,p}addr_t ; vm_size_t -> {v,p}size_tArtur Grabowski
1999-03-12in scheduler, bias parents for child cpu usage; ross@ghs.comTheo de Raadt
1999-03-02RFNOWAIT does not dissociate the child from its parent in any otherNiklas Hallqvist
way than that the parent wait call will never get the status of this child, says Rob
1999-02-26kmem allocation changes for uvm, and vm_fork -> uvm_fork (with one extra ↵Artur Grabowski
argument)
1999-02-23update the comment about number of allowed processesArtur Grabowski
1999-02-23Allow up to 5 (was 1) root processes when the process limit is reached.Artur Grabowski
This gives root a bigger chance to fix any problem that caused the limit to be reached.
1999-02-23Ooops! Move the allocation of the U area to after the limits checks.Artur Grabowski
That was a memory leak.
1999-02-19Allocate the u-area early in fork1 instead of in vm_fork.Artur Grabowski
Now we can return ENOMEM instead of doing a panic when we run out of memory.
1999-01-11just check rforkflags if ISRFORKNiklas Hallqvist
1999-01-10Make RFNOWAIT work in rfork(2)Niklas Hallqvist
1997-08-01only allow setuid if fd_refcnt == 1, due to rforkTheo de Raadt
1997-08-01disable RFFDG; long explanation...Theo de Raadt