summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Added a copyright to this file.dg1995-07-131-0/+33
|
* Oops, forgot to add the "default" pager files...dg1995-07-132-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: libkvm, w, ps, 'top', and any other utility which depends on struct proc or any VM system structure will have to be rebuilt!!! Much needed overhaul of the VM system. Included in this first round of changes: 1) Improved pager interfaces: init, alloc, dealloc, getpages, putpages, haspage, and sync operations are supported. The haspage interface now provides information about clusterability. All pager routines now take struct vm_object's instead of "pagers". 2) Improved data structures. In the previous paradigm, there is constant confusion caused by pagers being both a data structure ("allocate a pager") and a collection of routines. The idea of a pager structure has escentially been eliminated. Objects now have types, and this type is used to index the appropriate pager. In most cases, items in the pager structure were duplicated in the object data structure and thus were unnecessary. In the few cases that remained, a un_pager structure union was created in the object to contain these items. 3) Because of the cleanup of #1 & #2, a lot of unnecessary layering can now be removed. For instance, vm_object_enter(), vm_object_lookup(), vm_object_remove(), and the associated object hash list were some of the things that were removed. 4) simple_lock's removed. Discussion with several people reveals that the SMP locking primitives used in the VM system aren't likely the mechanism that we'll be adopting. Even if it were, the locking that was in the code was very inadequate and would have to be mostly re-done anyway. The locking in a uni-processor kernel was a no-op but went a long way toward making the code difficult to read and debug. 5) Places that attempted to kludge-up the fact that we don't have kernel thread support have been fixed to reflect the reality that we are really dealing with processes, not threads. The VM system didn't have complete thread support, so the comments and mis-named routines were just wrong. We now use tsleep and wakeup directly in the lock routines, for instance. 6) Where appropriate, the pagers have been improved, especially in the pager_alloc routines. Most of the pager_allocs have been rewritten and are now faster and easier to maintain. 7) The pagedaemon pageout clustering algorithm has been rewritten and now tries harder to output an even number of pages before and after the requested page. This is sort of the reverse of the ideal pagein algorithm and should provide better overall performance. 8) Unnecessary (incorrect) casts to caddr_t in calls to tsleep & wakeup have been removed. Some other unnecessary casts have also been removed. 9) Some almost useless debugging code removed. 10) Terminology of shadow objects vs. backing objects straightened out. The fact that the vm_object data structure escentially had this backwards really confused things. The use of "shadow" and "backing object" throughout the code is now internally consistent and correct in the Mach terminology. 11) Several minor bug fixes, including one in the vm daemon that caused 0 RSS objects to not get purged as intended. 12) A "default pager" has now been created which cleans up the transition of objects to the "swap" type. The previous checks throughout the code for swp->pg_data != NULL were really ugly. This change also provides the rudiments for future backing of "anonymous" memory by something other than the swap pager (via the vnode pager, for example), and it allows the decision about which of these pagers to use to be made dynamically (although will need some additional decision code to do this, of course). 13) (dyson) MAP_COPY has been deprecated and the corresponding "copy object" code has been removed. MAP_COPY was undocumented and non- standard. It was furthermore broken in several ways which caused its behavior to degrade to MAP_PRIVATE. Binaries that use MAP_COPY will continue to work correctly, but via the slightly different semantics of MAP_PRIVATE. 14) (dyson) Sharing maps have been removed. It's marginal usefulness in a threads design can be worked around in other ways. Both #12 and #13 were done to simplify the code and improve readability and maintain- ability. (As were most all of these changes) TODO: 1) Rewrite most of the vnode pager to use VOP_GETPAGES/PUTPAGES. Doing this will reduce the vnode pager to a mere fraction of its current size. 2) Rewrite vm_fault and the swap/vnode pagers to use the clustering information provided by the new haspage pager interface. This will substantially reduce the overhead by eliminating a large number of VOP_BMAP() calls. The VOP_BMAP() filesystem interface should be improved to provide both a "behind" and "ahead" indication of contiguousness. 3) Implement the extended features of pager_haspage in swap_pager_haspage(). It currently just says 0 pages ahead/behind. 4) Re-implement the swap device (swstrategy) in a more elegant way, perhaps via a much more general mechanism that could also be used for disk striping of regular filesystems. 5) Do something to improve the architecture of vm_object_collapse(). The fact that it makes calls into the swap pager and knows too much about how the swap pager operates really bothers me. It also doesn't allow for collapsing of non-swap pager objects ("unnamed" objects backed by other pagers).
* NOTE: libkvm, w, ps, 'top', and any other utility which depends on structdg1995-07-1328-3050/+1073
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | proc or any VM system structure will have to be rebuilt!!! Much needed overhaul of the VM system. Included in this first round of changes: 1) Improved pager interfaces: init, alloc, dealloc, getpages, putpages, haspage, and sync operations are supported. The haspage interface now provides information about clusterability. All pager routines now take struct vm_object's instead of "pagers". 2) Improved data structures. In the previous paradigm, there is constant confusion caused by pagers being both a data structure ("allocate a pager") and a collection of routines. The idea of a pager structure has escentially been eliminated. Objects now have types, and this type is used to index the appropriate pager. In most cases, items in the pager structure were duplicated in the object data structure and thus were unnecessary. In the few cases that remained, a un_pager structure union was created in the object to contain these items. 3) Because of the cleanup of #1 & #2, a lot of unnecessary layering can now be removed. For instance, vm_object_enter(), vm_object_lookup(), vm_object_remove(), and the associated object hash list were some of the things that were removed. 4) simple_lock's removed. Discussion with several people reveals that the SMP locking primitives used in the VM system aren't likely the mechanism that we'll be adopting. Even if it were, the locking that was in the code was very inadequate and would have to be mostly re-done anyway. The locking in a uni-processor kernel was a no-op but went a long way toward making the code difficult to read and debug. 5) Places that attempted to kludge-up the fact that we don't have kernel thread support have been fixed to reflect the reality that we are really dealing with processes, not threads. The VM system didn't have complete thread support, so the comments and mis-named routines were just wrong. We now use tsleep and wakeup directly in the lock routines, for instance. 6) Where appropriate, the pagers have been improved, especially in the pager_alloc routines. Most of the pager_allocs have been rewritten and are now faster and easier to maintain. 7) The pagedaemon pageout clustering algorithm has been rewritten and now tries harder to output an even number of pages before and after the requested page. This is sort of the reverse of the ideal pagein algorithm and should provide better overall performance. 8) Unnecessary (incorrect) casts to caddr_t in calls to tsleep & wakeup have been removed. Some other unnecessary casts have also been removed. 9) Some almost useless debugging code removed. 10) Terminology of shadow objects vs. backing objects straightened out. The fact that the vm_object data structure escentially had this backwards really confused things. The use of "shadow" and "backing object" throughout the code is now internally consistent and correct in the Mach terminology. 11) Several minor bug fixes, including one in the vm daemon that caused 0 RSS objects to not get purged as intended. 12) A "default pager" has now been created which cleans up the transition of objects to the "swap" type. The previous checks throughout the code for swp->pg_data != NULL were really ugly. This change also provides the rudiments for future backing of "anonymous" memory by something other than the swap pager (via the vnode pager, for example), and it allows the decision about which of these pagers to use to be made dynamically (although will need some additional decision code to do this, of course). 13) (dyson) MAP_COPY has been deprecated and the corresponding "copy object" code has been removed. MAP_COPY was undocumented and non- standard. It was furthermore broken in several ways which caused its behavior to degrade to MAP_PRIVATE. Binaries that use MAP_COPY will continue to work correctly, but via the slightly different semantics of MAP_PRIVATE. 14) (dyson) Sharing maps have been removed. It's marginal usefulness in a threads design can be worked around in other ways. Both #12 and #13 were done to simplify the code and improve readability and maintain- ability. (As were most all of these changes) TODO: 1) Rewrite most of the vnode pager to use VOP_GETPAGES/PUTPAGES. Doing this will reduce the vnode pager to a mere fraction of its current size. 2) Rewrite vm_fault and the swap/vnode pagers to use the clustering information provided by the new haspage pager interface. This will substantially reduce the overhead by eliminating a large number of VOP_BMAP() calls. The VOP_BMAP() filesystem interface should be improved to provide both a "behind" and "ahead" indication of contiguousness. 3) Implement the extended features of pager_haspage in swap_pager_haspage(). It currently just says 0 pages ahead/behind. 4) Re-implement the swap device (swstrategy) in a more elegant way, perhaps via a much more general mechanism that could also be used for disk striping of regular filesystems. 5) Do something to improve the architecture of vm_object_collapse(). The fact that it makes calls into the swap pager and knows too much about how the swap pager operates really bothers me. It also doesn't allow for collapsing of non-swap pager objects ("unnamed" objects backed by other pagers).
* swapout_threads() -> swapout_procs().dg1995-07-103-6/+6
|
* Increased global RSS limit to total RAM.dg1995-07-101-2/+2
|
* Moved call to VOP_GETATTR() out of vnode_pager_alloc() and into the placesdg1995-07-092-39/+31
| | | | | | that call vnode_pager_alloc() so that a failure return can be dealt with. This fixes a panic seen on NFS clients when a file being opened is deleted on the server before the open completes.
* Fixed an object allocation race condition that was causing a "objectdg1995-07-061-13/+34
| | | | | | deallocated too many times" panic when using NFS. Reviewed by: John Dyson
* 1) Converted v_vmdata to v_object.dg1995-06-281-11/+11
| | | | | | | 2) Removed unnecessary vm_object_lookup()/pager_cache(object, TRUE) pairs after vnode_pager_alloc() calls - the object is already guaranteed to be persistent. 3) Removed some gratuitous casts.
* Merge RELENG_2_0_5 into HEADrgrimes1995-06-111-3/+3
|
* Remove trailing whitespace.rgrimes1995-05-3014-130/+130
|
* Removed check for sw_dev == NODEV; this is a normal condition for swapdg1995-05-251-3/+2
| | | | | | | over NFS and was gratuitously panicing when it happens. Reviewed by: John Dyson Submitted by: Pierre Beyssac via Poul-Henning Kamp
* Changes to fix the following bugs:dg1995-05-212-3/+4
| | | | | | | | | | | | | | | 1) Files weren't properly synced on filesystems other than UFS. In some cases, this lead to lost data. Most likely would be noticed on NFS. The fix is to make the VM page sync/object_clean general rather than in each filesystem. 2) Mixing regular and mmaped file I/O on NFS was very broken. It caused chunks of files to end up as zeroes rather than the intended contents. The fix was to fix several race conditions and to kludge up the "b_dirtyoff" and "b_dirtyend" that NFS relies upon - paying attention to page modifications that occurred via the mmapping. Reviewed by: David Greenman Submitted by: John Dyson
* NFS diskless operation was broken because swapdev_vp wasn't initialized.dg1995-05-191-1/+6
| | | | | | | These changes solve the problem in a general way by moving the initialization out of the individual fs_mountroot's and into swaponvp(). Submitted by: Poul-Henning Kamp
* Fixed a bug that managed to slip in during Poul's dynamic swap partitiondg1995-05-181-17/+11
| | | | | | | | changes. The check for nswap was bogus, but the code was so convoluted that it was difficult to tell. It's better now. :-) Reviewed by: David Greenman (extensively), and John Dyson Submitted by: Poul-Henning Kamp, w/tweaks by me.
* Accessing pages beyond the end of a mapped file results in internaldg1995-05-185-26/+37
| | | | | | | | | | | | | inconsistencies in the VM system that eventually lead to a panic. These changes fix the behavior to conform to the behavior in SunOS, which is to deny faults to pages beyond the EOF (returning SIGBUS). Internally, this is implemented by requiring faults to be within the object size boundaries. These changes exposed another bug, namely that passing in an offset to mmap when trying to map an unnamed anonymous region also results in internal inconsistencies. In this case, the offset is forced to zero. Reviewed by: John Dyson and others
* Changed swap partition handling/allocation so that it doesn'tdg1995-05-143-122/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | require specific partitions be mentioned in the kernel config file ("swap on foo" is now obsolete). From Poul-Henning: The visible effect is this: As default, unless options "NSWAPDEV=23" is in your config, you will have four swap-devices. You can swapon(2) any block device you feel like, it doesn't have to be in the kernel config. There is a performance/resource win available by getting the NSWAPDEV right (but only if you have just one swap-device ??), but using that as default would be too restrictive. The invisible effect is that: Swap-handling disappears from the $arch part of the kernel. It gets a lot simpler (-145 lines) and cleaner. Reviewed by: John Dyson, David Greenman Submitted by: Poul-Henning Kamp, with minor changes by me.
* I'm about to jump on the swap-initialization, and having talkedphk1995-05-121-132/+1
| | | | | | | | | | | | | | | with davidg about it, I hereby kill two undocumented misfeatures: The code to skip a miniroot in the swapdev is not particular useful, and if we need it we need it to be done properly, ie size the fs and skip all of it not some hardcoded size, and subtract what we skip from the length in the first place. The SEQSWAP dies too. It's not the way to do it, it doesn't work, and nobody have expressed any great desire for it to work. The way to implement it correctly would be a second argument to swapon(2) to give a priority/policy information. Low priority swapdevs can be made so by adding them at a far offset (0x80000000 kind of thing), with almost no modification to the strategy routine (in particular a offset per swapdev). But until the need is obvious, it will not be done.
* Changed "handle" from type caddr_t to void *; "handle" is several differentdg1995-05-108-19/+19
| | | | types of pointers, and "char *" is a bad choice for the type.
* Another error in the correction for trimming swap allocation fordyson1995-05-071-4/+4
| | | | small objects. (This code needs to be revisited.)
* Fixed a calculation that would once-in-a-while cause the swap_pagerdyson1995-05-071-12/+4
| | | | | | | to emit spurious page outside of object type messages. It is not a fatal condition anyway, so the message will be omitted for release. Also, the code that "clips" the allocation size, associated with the above problem, was fixed.
* Changed object hash list to be a list rather than a tailq. This savesdg1995-05-022-29/+22
| | | | | | | space for the hash list buckets and is a little faster. The features of tailq aren't needed. Increased the size of the object hash table to improve performance. In the future, this will be changed so that the table is sized dynamically.
* Fixed a "bswbuf" hang caused by the wakeup in relpbuf() waking up thedg1995-04-251-2/+2
| | | | wrong thing.
* inline -> __inline.bde1995-04-231-4/+4
| | | | | | Headers should always use `__inline' for inline functions to avoid syntax errors when modules that don't even use the offending functions are compiled with `gcc -ansi'.
* Fixed a problem in _vm_object_page_clean that could cause andyson1995-04-211-4/+6
| | | | infinite loop.
* New flag: B_PAGING. Added as part of the vn driver hack.dg1995-04-191-3/+3
|
* Fixed a logic bug that caused the vmdaemon to not wake up when intended.dg1995-04-171-22/+27
| | | | Submitted by: John Dyson
* Removed obsolete/unused variable declarations. Killed externs and includeddg1995-04-162-11/+4
| | | | appropriate include files.
* Removed obsolete/unused variable declarations.dg1995-04-161-12/+3
| | | | Removed some extern declarations and included the correct include files.
* Moved some zero-initialized variables into .bss. Made code intended to bedg1995-04-169-36/+29
| | | | called only from DDB #ifdef DDB. Removed some completely unused globals.
* Removed gratuitous m->blah=0 assignments when initializing the vm_pagedg1995-04-161-4/+1
| | | | | structs in vm_page_startup(). The vm_page structs are already completely zeroed.
* Make "print_page_info" #ifdef DDB.dg1995-04-161-2/+3
|
* Fixed a few bugs in vm_object_page_clean, mostly related to not syncingdg1995-04-161-11/+21
| | | | | | | | pages that are in FS buffers. This fixes the (believed to already have been fixed) problem with msync() not doing it's job...in other words, the stuff that Andrew has continuously been complaining about. Submitted by: John Dyson, w/minor changes by me.
* Changes from John Dyson and myself:dg1995-04-097-479/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed remaining known bugs in the buffer IO and VM system. vfs_bio.c: Fixed some race conditions and locking bugs. Improved performance by removing some (now) unnecessary code and fixing some broken logic. Fixed process accounting of # of FS outputs. Properly handle NFS interrupts (B_EINTR). (various) Replaced calls to clrbuf() with calls to an optimized routine called vfs_bio_clrbuf(). (various FS sync) Sync out modified vnode_pager backed pages. ffs_vnops.c: Do two passes: Sync out file data first, then indirect blocks. vm_fault.c: Fixed deadly embrace caused by acquiring locks in the wrong order. vnode_pager.c: Changed to use buffer I/O system for writing out modified pages. This should fix the problem with the modification date previous not getting updated. Also dramatically simplifies the code. Note that this is going to change in the future and be implemented via VOP_PUTPAGES(). vm_object.c: Fixed a pile of bugs related to cleaning (vnode) objects. The performance of vm_object_page_clean() is terrible when dealing with huge objects, but this will change when we implement a binary tree to keep the object pages sorted. vm_pageout.c: Fixed broken clustering of pageouts. Fixed race conditions and other lockup style bugs in the scanning of pages. Improved performance.
* Add and move declarations to fix all of the warnings from `gcc -Wimplicit'bde1995-03-281-1/+2
| | | | | (except in netccitt, netiso and netns) that I didn't notice when I fixed "all" such warnings before.
* Fixed typo...using wrong variable in page_shortage calculation.dg1995-03-281-2/+2
|
* Fixed "pages freed by daemon" statistic (again).dg1995-03-281-1/+3
|
* Explicitly set page dirty if this is a write fault - reduces calls todg1995-03-271-2/+11
| | | | pmap_is_modified() later.
* Removed some obsolete flags.dg1995-03-261-6/+3
| | | | Submitted by: John Dyson
* Fix logic bug I just introduced with the flags to msync().dg1995-03-251-2/+2
|
* Pass syncio flag to vm_object_clean(). It remains unimplemented, however.dg1995-03-251-4/+1
|
* Disallow both MS_ASYNC and MS_INVALIDATE flags being set at the same timedg1995-03-251-3/+6
| | | | in msync().
* Added "flags" argument to msync, and implemented MS_ASYNC and MS_INVALIDATE.dg1995-03-251-14/+11
| | | | | The MS_ASYNC flag doesn't current work, and MS_INVALIDATE will only toss out the pages in the address space (not all pages in the shadow chain).
* Implemented cnt.v_reactivated and moved vm_page_activate() routine todg1995-03-251-39/+41
| | | | before vm_page_deactivate().
* Removed (almost) meaningless "object cache lookups/hits" statistic. Indg1995-03-251-3/+1
| | | | | our framework, these numbers will usually be nearly the same, and not because of any sort of high 'hit rate'.
* Removed cnt.v_nzfod: In our current scheme of things it is not possibledg1995-03-251-2/+1
| | | | | | | | to accurately track this. It isn't an indicator of resource consumption anyway. Removed cnt.v_kernel_pages: We don't implement this and doing so accurately would be very difficult (and ambiguous - since process pages are often double mapped in the kernel and the process address spaces).
* Fixed warning caused by returning a value in a void function (introduceddg1995-03-231-3/+3
| | | | | in a recent commit by me). Relaxed checks before calling vm_object_remove; a non-internal object always has a pager.
* Removed unused fifth argument to vm_object_page_clean(). Fixed bug withdg1995-03-223-35/+40
| | | | | | | | VTEXT not always getting cleared when it is supposed to. Added check to make sure that vm_object_remove() isn't called with a NULL pager or for a pager for an OBJ_INTERNAL object (neither of which will be on the hash list). Clear OBJ_CANPERSIST if we decide to terminate it because of no resident pages.
* Fixed potential sleep/wakeup race conditional with splhigh().dg1995-03-221-2/+6
| | | | Submitted by: John Dyson
* Added a check for wrong object size; print a warning, but deal with itdg1995-03-221-1/+9
| | | | | | | correctly. The warning will tell us that there is a bug somewhere else in sizing the object correctly. Submitted by: John Dyson
* Fixed bug in vm_mmap() where the object that is created in some casesdg1995-03-221-2/+2
| | | | | | | | was the wrong size. This is the likely cause of panics reported by Lars Fredriksen and Paul Richards related to a -1 blkno when paging via the swap_pager. Submitted by: John Dyson
OpenPOWER on IntegriCloud