summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Don't lock around swap_pager_swap_init() that is only called once duringjhb2001-06-201-0/+2
| | | | | the pagedaemon's startup code since it calls malloc which results in lock order reversals.
* Put the scheduler, vmdaemon, and pagedaemon kthreads back under Giant forjhb2001-06-202-19/+1
| | | | | now. The proc locking isn't actually safe yet and won't be until the proc locking is finished.
* Cleanup the tabbingdillon2001-06-111-17/+16
|
* Two fixes to the out-of-swap process termination code. First, start killingdillon2001-06-093-3/+44
| | | | | | | | | | | processes a little earlier to avoid a deadlock. Second, when calculating the 'largest process' do not just count RSS. Instead count the RSS + SWAP used by the process. Without this the code tended to kill small inconsequential processes like, oh, sshd, rather then one of the many 'eatmem 200MB' I run on a whim :-). This fix has been extensively tested on -stable and somewhat tested on -current and will be MFCd in a few days. Shamed into fixing this by: ps
* Change the way information about swap devices is exported to be moretmm2001-06-012-28/+46
| | | | | | | | canonical: define a versioned struct xswdev, and add a sysctl node handler that allows the user to get this structure for a certain device index by specifying this index as last element of the MIB. This new node handler, vm.swap_info, replaces the old vm.nswapdev and vm.swapdevX.* (where X was the index) sysctls.
* Clean up the code exporting interrupt statistics via sysctl a bit:tmm2001-06-011-30/+0
| | | | | | | | | | | | | - move the sysctl code to kern_intr.c - do not use INTRCNT_COUNT, but rather eintrcnt - intrcnt to determine the length of the intrcnt array - move the declarations of intrnames, eintrnames, intrcnt and eintrcnt from machine-dependent include files to sys/interrupt.h - remove the hw.nintr sysctl, it is not needed. - fix various style bugs Requested by: bde Reviewed by: bde (some time ago)
* Don't hold the VM lock across VOP's and other things that can sleep.jhb2001-05-291-2/+19
|
* Stick VM syscalls back under Giant if the BLEED option is not defined.jhb2001-05-242-0/+57
|
* This patch implements O_DIRECT about 80% of the way. It takes a patchsetdillon2001-05-242-0/+24
| | | | | | | | | | | | | | | | Tor created a while ago, removes the raw I/O piece (that has cache coherency problems), and adds a buffer cache / VM freeing piece. Essentially this patch causes O_DIRECT I/O to not be left in the cache, but does not prevent it from going through the cache, hence the 80%. For the last 20% we need a method by which the I/O can be issued directly to buffer supplied by the user process and bypass the buffer cache entirely, but still maintain cache coherency. I also have the code working under -stable but the changes made to sys/file.h may not be MFCable, so an MFC is not on the table yet. Submitted by: tegge, dillon
* - Assert Giant is held in the vnode pager methods.jhb2001-05-231-14/+18
| | | | | - Lock the VM while walking down a vm_object's backing_object list in vnode_pager_lock().
* - Add in several asserts of vm_mtx.jhb2001-05-231-5/+42
| | | | | | | | | - Assert Giant in vm_pageout_scan() for the vnode hacking that it does. - Don't hold vm_mtx around vget() or vput(). - Lock Giant when calling vm_pageout_scan() from the pagedaemon. Also, lock curproc while setting the P_BUFEXHAUST flag. - For now we still hold Giant for all of the vm_daemon. When process limits are locked we will be only need Giant for swapout_procs().
* - Assert that the vm lock is held for all of _vm_object_allocate().jhb2001-05-231-31/+48
| | | | | | | | | | | | | | - Restore the previous order of setting up a new vm_object. The previous had a small bug where we zero'd out the flags after we set the OBJ_ONEMAPPING flag. - Add several asserts of vm_mtx. - Assert Giant is held rather than locking and unlocking it in a few places. - Add in some #ifdef objlocks code to lock individual vm objects when vm objects each have their own lock someday. - Don't bother acquiring the allproc lock for a ddb command. If DDB blocked on the lock, that would be worse than having an inconsistent allproc list.
* - Add lots of vm_mtx assertions.jhb2001-05-231-2/+39
| | | | | | | - Add a few KTR tracepoints to track the addition and removal of vm_map_entry's and the creation adn free'ing of vmspace's. - Adjust a few portions of code so that we update the process' vmspace pointer to its new vmspace before freeing the old vmspace.
* - Lock the VM around the pmap_swapin_proc() call in faultin().jhb2001-05-231-15/+16
| | | | | | | | | | | | | | | - Don't lock Giant in the scheduler() function except for when calling faultin(). - In swapout_procs(), lock the VM before the proccess to avoid a lock order violation. - In swapout_procs(), release the allproc lock before calling swapout(). We restart the process scan after swapping out a process. - In swapout_procs(), un #if 0 the code to bump the vmspace reference count and lock the process' vm structures. This bug was introduced by me and could result in the vmspace being free'd out from under a running process. - Fix an old bug where the vmspace reference count was not free'd if we failed the swap_idle_threshold2 test.
* - Fix the sw_alloc_interlock to actually lock itself when the lock isjhb2001-05-231-16/+20
| | | | | | | acquired. - Assert Giant is held in the strategy, getpages, and putpages methods and the getchainbuf, flushchainbuf, and waitchainbuf functions. - Always call flushchainbuf() w/o the VM lock.
* Assert Giant is held for the device pager alloc and getpages methods sincejhb2001-05-231-3/+3
| | | | we call the mmap method of the cdevsw of the device we are mmap'ing.
* - Obtain Giant in mmap() syscall while messing with file descriptors andjhb2001-05-231-18/+32
| | | | | | | | | | | vnodes. - Fix an old bug that would leak a reference to a fd if the vnode being mmap'd wasn't of type VREG or VCHR. - Lock Giant in vm_mmap() around calls into the VM that can call into pager routines that need Giant or into other VM routines that need Giant. - Replace code that used a goto to jump around the else branch of a test to use an else branch instead.
* Acquire Giant around vm_map_remove() inside of the obreak() syscall forjhb2001-05-231-2/+7
| | | | vm_object_terminate().
* Take a more conservative approach and still lock Giant around VM faultsjhb2001-05-231-8/+6
| | | | for now.
* Set the phys_pager_alloc_lock to 1 when it is acquired so that it isjhb2001-05-231-1/+2
| | | | actually locked.
* aquire Giant when playing with the buffercache and doing IO.alfred2001-05-231-2/+5
| | | | use msleep against the vm mutex while waiting for a page IO to complete.
* aquire vm mutex in swp_pager_async_iodone. Don't call swp_pager_async_iodonealfred2001-05-221-2/+3
| | | | with the mutex held.
* Remove duplicate include and sort includes.jhb2001-05-221-3/+2
|
* Sort includes.jhb2001-05-221-1/+1
|
* Unlock the VM lock at the end of munlock() instead of locking it again.jhb2001-05-221-1/+1
|
* Sort includes from previous commit.jhb2001-05-221-1/+1
|
* Sort includes.jhb2001-05-221-3/+3
|
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-1922-171/+643
| | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
* - Use a timeout for the tsleep in scheduler() instead of having vmmeter()jhb2001-05-182-5/+22
| | | | | | | | | | | | | | | wakeup proc0 by hand to enforce the timeout. - When swapping out a process, keep the process locked via the proc lock from the first checks up until we clear PS_INMEM and set PS_SWAPPING in swapout(). The swapout() function now must be called with the proc lock held and releases it before returning. - Comment out the code to attempt to lock a process' VM structures before swapping out. It is broken in that it releases the lock after obtaining it. If it does grab the lock, it needs to hand it off to swapout() instead of releasing it. This can be revisisted when the VM is locked as this is a valid test to perform. It also causes a lock order reversal for the time being, which is the immediate cause for temporarily disabling it.
* During the code to pick a process to kill when memory is exhausted, keepjhb2001-05-171-3/+18
| | | | | | | the process in question locked as soon as we find it and determine it to be eligible until we actually kill it. To avoid deadlock, we don't block on the process lock but skip any process that is already locked during our search.
* - Use PROC_LOCK_ASSERT instead of a direct mtx_assert.jhb2001-05-151-8/+6
| | | | | | | | | | | | - Don't hold Giant in the swapper daemon while we walk the list of processes looking for a process to swap back in. - Don't bother grabbing the sched_lock while checking a process' sleep time in swapout_procs() to ensure that a process has been idle for at least swap_idle_threshold2 before swapping it out. If we lose the race we just let a process stay in memory until the next call of swapout_procs(). - Remove some unneeded spl's, sched_lock does all the locking needed in this case.
* Actually biofinish(struct bio *, struct devstat *, int error) is more generalphk2001-05-061-3/+1
| | | | | | than the bioerror(). Most of this patch is generated by scripts.
* Putting sys/lockmgr.h in here allows us to depollute userland includesmarkm2001-05-031-0/+2
| | | | | a bit. OK'ed by: bde
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-0114-18/+30
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Revert consequences of changes to mount.h, part 2.grog2001-04-292-4/+0
| | | | Requested by: bde
* Address a number of problems with sysctl_vm_zone().alfred2001-04-271-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zone allocator's locks should be leaflocks, meaning that they should never be held when entering into another subsystem, however the sysctl grabs the zone global mutex and individual zone mutexes while holding the lock it calls SYSCTL_OUT which recurses into the VM subsystem in order to wire user memory to do a safe copy. This can block and cause lock order reversals. To fix this: lock zone global. get a count of the number of zones. unlock global. allocate temporary storage. format and SYSCTL_OUT the banner. lock global. traverse list. make sure we haven't looped more than the initial count taken to avoid overflowing the allocated buffer. lock each nodes. read values and format into buffer. unlock individual node. unlock global. format and SYSCTL_OUT the rest of the data. free storage. return. Other problems included not checking for errors when doing sysctl out of the column header. Fixed. Inconsistant termination of the copied string. Fixed. Objected to by: des (for not using sbuf) Since the output is not variable length and I'm actually over allocating signifigantly and I'd like to get this fixed now, I'll work on the sbuf convertion at a later date. I would not object to someone else taking it upon themselves to convert it to sbuf. I hold no MAINTIANER rights to this code (for now).
* Correct #includes to work with fixed sys/mount.h.grog2001-04-232-0/+4
|
* vnode_pager_freepage() is really vm_page_free() in disguise,alfred2001-04-192-15/+7
| | | | nuke vnode_pager_freepage() and replace all calls to it with vm_page_free()
* Protect pager object creation with sx locks.alfred2001-04-183-33/+43
| | | | | | | | Protect pager object list manipulation with a mutex. It doesn't look possible to combine them under a single sx lock because creation may block and we can't have the object list manipulation block on anything other than a mutex because of interrupt requests.
* Fix the botched rev 1.59 where I made it such that without INVARIANTSalfred2001-04-181-2/+2
| | | | | | the map is never locked. Submitted by: tegge
* This patch removes the VOP_BWRITE() vector.phk2001-04-171-0/+2
| | | | | | | | | | | | | VOP_BWRITE() was a hack which made it possible for NFS client side to use struct buf with non-bio backing. This patch takes a more general approach and adds a bp->b_op vector where more methods can be added. The success of this patch depends on bp->b_op being initialized all relevant places for some value of "relevant" which is not easy to determine. For now the buffers have grown a b_magic element which will make such issues a tiny bit easier to debug.
* use TAILQ_FOREACH, fix a comment's locationalfred2001-04-153-15/+6
|
* if/panic -> KASSERTalfred2001-04-131-7/+8
|
* protect pbufs and associated counts with a mutexalfred2001-04-133-2/+14
|
* use %p for pointer printf, include sys/systm.h for printf protoalfred2001-04-131-6/+7
|
* Use a macro wrapper over printf along with KASSERT to reduce the amountalfred2001-04-131-40/+15
| | | | of code here.
* remove truncated part from commmentalfred2001-04-121-1/+1
|
* Convert the allproc and proctree locks from lockmgr locks to sx locks.jhb2001-03-284-15/+20
|
* Catch up to header include changes:jhb2001-03-281-0/+1
| | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
* Export intrnames and intrcnt as sysctls (hw.nintr, hw.intrnames andtmm2001-03-231-0/+30
| | | | | | hw.intrcnt). Approved by: rwatson
OpenPOWER on IntegriCloud