summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Fix missing newline and terminator at the end of the vm.zone sysctl.des2001-07-091-2/+1
|
* Apply field bandages to the includes so compiles happen on alpha.mjacob2001-07-051-0/+6
|
* Move vm_page_zero_idle() from machine-dependant sections to adillon2001-07-051-0/+117
| | | | | machine-independant source file, vm/vm_zeroidle.c. It was exactly the same for all platforms and updating them all was getting annoying.
* Reorg vm_page.c into vm_page.c, vm_pageq.c, and vm_contig.c (for contigmalloc).dillon2001-07-046-465/+621
| | | | | | | | | | | Also removed some spl's and added some VM mutexes, but they are not actually used yet, so this commit does not really make any operational changes to the system. vm_page.c relates to vm_page_t manipulation, including high level deactivation, activation, etc... vm_pageq.c relates to finding free pages and aquiring exclusive access to a page queue (exclusivity part not yet implemented). And the world still builds... :-)
* Change inlines back into mainline code in preparation for mutexing. Also,dillon2001-07-046-840/+729
| | | | | | | | most of these inlines had been bloated in -current far beyond their original intent. Normalize prototypes and function declarations to be ANSI only (half already were). And do some general cleanup. (kernel size also reduced by 50-100K, but that isn't the prime intent)
* whitespace / register cleanupdillon2001-07-0412-80/+81
|
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-0423-658/+294
| | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
* Fix a XXX comment by moving the initialization of the number of pbuf'sjhb2001-07-031-9/+9
| | | | | for the vnode pager to a new vnode pager init method instead of making it a hack in getpages().
* - Protect all accesses to nsw_[rw]count{,_{,a}sync} with the pbuf mutex.jhb2001-06-221-4/+4
| | | | | - Don't drop the vm mutex while grabbing the pbuf mutex to manipulate said variables.
* Introduce numerous SMP friendly changes to the mbuf allocator. Namely,bmilekic2001-06-224-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a modified allocation mechanism for mbufs and mbuf clusters; one which can scale under SMP and which offers the possibility of resource reclamation to be implemented in the future. Notable advantages: o Reduce contention for SMP by offering per-CPU pools and locks. o Better use of data cache due to per-CPU pools. o Much less code cache pollution due to excessively large allocation macros. o Framework for `grouping' objects from same page together so as to be able to possibly free wired-down pages back to the system if they are no longer needed by the network stacks. Additional things changed with this addition: - Moved some mbuf specific declarations and initializations from sys/conf/param.c into mbuf-specific code where they belong. - m_getclr() has been renamed to m_get_clrd() because the old name is really confusing. m_getclr() HAS been preserved though and is defined to the new name. No tree sweep has been done "to change the interface," as the old name will continue to be supported and is not depracated. The change was merely done because m_getclr() sounds too much like "m_get a cluster." - TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and systat(1) (see TODO below). - Fixed systat(1) to display number of "free mbufs" based on new per-CPU stat structures. - Fixed netstat(1) to display new per-CPU stats based on sysctl-exported per-CPU stat structures. All infos are fetched via sysctl. TODO (in order of priority): - Re-enable mbtypes statistics in both netstat(1) and systat(1) after introducing an SMP friendly way to collect the mbtypes stats under the already introduced per-CPU locks (i.e. hopefully don't use atomic() - it seems too costly for a mere stat update, especially when other locks are already present). - Optionally have systat(1) display not only "total free mbufs" but also "total free mbufs per CPU pool." - Fix minor length-fetching issues in netstat(1) related to recently re-enabled option to read mbuf stats from a core file. - Move reference counters at least for mbuf clusters into an unused portion of the cluster itself, to save space and need to allocate a counter. - Look into introducing resource freeing possibly from a kproc. Reviewed by (in parts): jlemon, jake, silby, terry Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha) Preliminary performance measurements: jlemon (and me, obviously) URL: http://people.freebsd.org/~bmilekic/mb_alloc/
* 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
OpenPOWER on IntegriCloud