summaryrefslogtreecommitdiffstats
path: root/sys/vm/swap_pager.c
Commit message (Collapse)AuthorAgeFilesLines
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Use devtoname to print dev_t's instead of casting them to u_long forbde1999-08-231-6/+7
| | | | | | misprinting with %lx. Cast pointers to intptr_t instead of casting them to long. Cosmetic.
* Correct an accidental omission of one "vm_page_undirty" replacementalc1999-08-171-2/+2
| | | | from the previous commit.
* Add the (inline) function vm_page_undirty for clearing the dirty bitmaskalc1999-08-171-2/+2
| | | | | | | | of a vm_page. Use it. Submitted by: dillon
* Remove vm_object::last_read. It is used by the old swap pager, butalc1999-07-161-2/+1
| | | | | | not by the new one, i.e., vm/swap_pager.c rev 1.108. Reviewed by: dillon@backplane.com
* Kirk missed a required BUF_KERNPROC(). Even though this is a non-asyncpeter1999-06-271-1/+2
| | | | | transfer, the b_iodone hook causes biodone() to release it from interrupt context.
* Convert buffer locking from using the B_BUSY and B_WANTED flags to usingmckusick1999-06-261-4/+5
| | | | | | | lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits.
* remove b_proc from struct buf, it's (now) unused.phk1999-05-061-5/+3
| | | | Reviewed by: dillon, bde
* Submitted by: Matt Dillon <dillon@freebsd.org>julian1999-03-141-17/+242
| | | | | | | | | | | The old VN device broke in -4.x when the definition of B_PAGING changed. This patch fixes this plus implements additional capabilities. The new VN device can be backed by a file ( as per normal ), or it can be directly backed by swap. Due to dependencies in VM include files (on opt_xxx options) the new vn device cannot be a module yet. This will be fixed in a later commit. This commit delimitted by tags {PRE,POST}_MATT_VNDEV
* Remove conditional sysctl'sdillon1999-02-211-46/+4
| | | | | | Leave swap_async_max sysctl intact, remove swap_cluster_max sysctl. Reviewed by: Alan Cox <alc@cs.rice.edu>
* Reviewed by: Alan Cox <alc@cs.rice.edu>dillon1999-02-211-9/+15
| | | | Fix problem w/ low-swap/low-memory handling as reported by Bruce Evans.
* Limit number of simultanious asynchronous swap pager I/Os that candillon1999-02-181-13/+109
| | | | | | | | | | | | | | | | | be in progress at any given moment. Add two swap tuneables to sysctl: vm.swap_async_max: 4 vm.swap_cluster_max: 16 Recommended values are a cluster size of 8 or 16 pages. async_max is about right for 1-4 swap devices. Reduce to 2 if swap is eating too much bandwidth, or even 1 if swap is both eating too much bandwidth and sitting on a slow network (10BaseT). The defaults work well across a broad range of configurations and should normally be left alone.
* Add hysteresis to the 'swap_pager_getswapspace; failed' console message.dillon1999-02-061-5/+9
| | | | | Also widen the hysteresis levels a little ( these really should be dynamically configured ).
* Remove unintended trigraph sequences in comments for -Walldillon1999-01-271-2/+2
|
* Change all manual settings of vm_page_t->dirty = VM_PAGE_BITS_ALLdillon1999-01-241-3/+3
| | | | | | to use the vm_page_dirty() inline. The inline can thus do sanity checks ( or not ) over all cases.
* vm_pager_put_pages() is passed an rcval array to hold per-page returndillon1999-01-241-7/+6
| | | | | | | values. The 'int' return value for the procedure was never used and not well defined in any case when there are mixed errors on pages, so it has been removed. vm_pager_put_pages() and associated vm_pager functions now return void.
* The default_pager's interaction with the swap_pager has been reorganized,dillon1999-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | and the swap_pager has been completely replaced. The new swap pager uses the new blist radix-tree based bitmap allocator for low level swap allocation and deallocation. The new allocator is effectively O(5) while the old one was O(N), and the new allocator allocates all required memory at init time rather then at allocate memory on the fly at run time. Swap metadata is allocated in clusters and stored in a hash table, eliminating linearly allocated structures. Many, many features have been rewritten or added. Swap space is now reallocated on the fly providing a poor-mans auto defragmentation of swap space. Swap space that is no longer needed is freed on a timely basis so no garbage collection is necessary. Swap I/O is marked B_ASYNC and NFS has been fixed to do the right thing with it, so NFS-based paging now has around 10x the performance as it did before ( previously NFS enforced synchronous I/O for paging ).
* This is a rather large commit that encompasses the new swapper,dillon1999-01-211-1246/+1307
| | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>
* KNFize, by bde.eivind1999-01-101-3/+3
|
* Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT aseivind1999-01-081-7/+5
| | | | | | | | | discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith
* Don't free swap in swap_pager_getpages(): this code probably cause thedt1998-12-291-23/+1
| | | | | | | | | | | "dying daemons" problem. (I thought this code was introduced in rev.1.80, but it just relaxed the condition.) Also, kill related "suggest more swap space" warning (also introduced in 1.80). It was confusing, to say the least... Requested by: msmith Not objected by: dg
* Fixed a null pointer panic in spc_free(). swap_pager_putpages()bde1998-11-191-7/+9
| | | | | | | | | | | almost always causes this panic for the curproc != pageproc case. This case apparently doesn't happen in normal operation, but it happens when vm_page_alloc_contig() is called when there is a memory hogging application that hasn't already been paged out. PR: 8632 Reviewed by: info@opensound.com (Dev Mazumdar), dg Broken in: rev.1.89 (1998/02/23)
* Use TAILQ macros for clean/dirty block list processing. Set b_xflagspeter1998-10-311-2/+2
| | | | rather than abusing the list next pointer with a magic number.
* Fixed two potentially serious classes of bugs:dg1998-10-131-5/+5
| | | | | | | | | | | | | | | | 1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however.
* Cosmetic changes to the PAGE_XXX macros to make them consistent withdfr1998-09-041-5/+5
| | | | the other objects in vm.
* Change various syscalls to use size_t arguments instead of u_int.dfr1998-08-241-8/+6
| | | | | | | | | | Add some overflow checks to read/write (from bde). Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags and vm_object::paging_in_progress to use operations which are not interruptable. Reviewed by: Bruce Evans <bde@zeta.org.au>
* Protect all modifications to paging_in_progress with splvm().dfr1998-08-131-1/+3
|
* Fixed two spl nesting bugs. They caused (at least) the entire pageoutbde1998-07-281-2/+2
| | | | | | | daemon to run at splvm() forever after swap_pager_putpages() is called from vm_pageout_scan(). Broken in: rev.1.189 (1998/02/23)
* Fixed printf format errors.bde1998-07-111-7/+11
|
* VOP_STRATEGY grows an (struct vnode *) argumentjulian1998-07-041-3/+3
| | | | | | as the value in b_vp is often not really what you want. (and needs to be frobbed). more cleanups will follow this. Reviewed by: Bruce Evans <bde@freebsd.org>
* Work around some VM bugs, the worst being an overly aggressivedyson1998-05-041-8/+11
| | | | | swap space free calculation. More complete fixes will be forthcoming, in a week.
* Tighten up management of memory and swap space during map allocation,dyson1998-04-291-10/+12
| | | | | | | deallocation cycles. This should provide a measurable improvement on swap and memory allocation on loaded systems. It is unlikely a complete solution. Also, provide more map info with procfs. Chuck Cranor spurred on this improvement.
* Support compiling with `gcc -ansi'.bde1998-04-151-7/+7
|
* This mega-commit is meant to fix numerous interrelated problems. Theredyson1998-03-071-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | has been some bitrot and incorrect assumptions in the vfs_bio code. These problems have manifest themselves worse on NFS type filesystems, but can still affect local filesystems under certain circumstances. Most of the problems have involved mmap consistancy, and as a side-effect broke the vfs.ioopt code. This code might have been committed seperately, but almost everything is interrelated. 1) Allow (pmap_object_init_pt) prefaulting of buffer-busy pages that are fully valid. 2) Rather than deactivating erroneously read initial (header) pages in kern_exec, we now free them. 3) Fix the rundown of non-VMIO buffers that are in an inconsistent (missing vp) state. 4) Fix the disassociation of pages from buffers in brelse. The previous code had rotted and was faulty in a couple of important circumstances. 5) Remove a gratuitious buffer wakeup in vfs_vmio_release. 6) Remove a crufty and currently unused cluster mechanism for VBLK files in vfs_bio_awrite. When the code is functional, I'll add back a cleaner version. 7) The page busy count wakeups assocated with the buffer cache usage were incorrectly cleaned up in a previous commit by me. Revert to the original, correct version, but with a cleaner implementation. 8) The cluster read code now tries to keep data associated with buffers more aggressively (without breaking the heuristics) when it is presumed that the read data (buffers) will be soon needed. 9) Change to filesystem lockmgr locks so that they use LK_NOPAUSE. The delay loop waiting is not useful for filesystem locks, due to the length of the time intervals. 10) Correct and clean-up spec_getpages. 11) Implement a fully functional nfs_getpages, nfs_putpages. 12) Fix nfs_write so that modifications are coherent with the NFS data on the server disk (at least as well as NFS seems to allow.) 13) Properly support MS_INVALIDATE on NFS. 14) Properly pass down MS_INVALIDATE to lower levels of the VM code from vm_map_clean. 15) Better support the notion of pages being busy but valid, so that fewer in-transit waits occur. (use p->busy more for pageouts instead of PG_BUSY.) Since the page is fully valid, it is still usable for reads. 16) It is possible (in error) for cached pages to be busy. Make the page allocation code handle that case correctly. (It should probably be a printf or panic, but I want the system to handle coding errors robustly. I'll probably add a printf.) 17) Correct the design and usage of vm_page_sleep. It didn't handle consistancy problems very well, so make the design a little less lofty. After vm_page_sleep, if it ever blocked, it is still important to relookup the page (if the object generation count changed), and verify it's status (always.) 18) In vm_pageout.c, vm_pageout_clean had rotted, so clean that up. 19) Push the page busy for writes and VM_PROT_READ into vm_pageout_flush. 20) Fix vm_pager_put_pages and it's descendents to support an int flag instead of a boolean, so that we can pass down the invalidate bit.
* 1) Use a more consistent page wait methodology.dyson1998-03-011-33/+30
| | | | | | | | | | | | | 2) Do not unnecessarily force page blocking when paging pages out. 3) Further improve swap pager performance and correctness, including fixing the paging in progress deadlock (except in severe I/O error conditions.) 4) Enable vfs_ioopt=1 as a default. 5) Fix and enable the page prezeroing in SMP mode. All in all, SMP systems especially should show a significant improvement in "snappyness."
* Fix page prezeroing for SMP, and fix some potential paging-in-progressdyson1998-02-251-3/+2
| | | | | | hangs. The paging-in-progress diagnosis was a result of Tor Egge's excellent detective work. Submitted by: Partially from Tor Egge.
* Significantly improve the efficiency of the swap pager, which appears todyson1998-02-231-285/+273
| | | | | | | | have declined due to code-rot over time. The swap pager rundown code has been clean-up, and unneeded wakeups removed. Lots of splbio's are changed to splvm's. Also, set the dynamic tunables for the pageout daemon to be more sane for larger systems (thereby decreasing the daemon overheadla.)
* Staticize.eivind1998-02-091-2/+2
|
* Back out DIAGNOSTIC changes.eivind1998-02-061-3/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+3
|
* This fix should help the panic problems in -current. Theredyson1998-02-031-36/+65
| | | | | | were some errors in "interval" management. Due to the clustering mechanism, the code is necessarily complex and error prone.
* Fix a performance problem caused by an earlier commit.dyson1998-02-011-2/+3
|
* Change the busy page mgmt, so that when pages are freed, theydyson1998-01-311-6/+3
| | | | | | | | | | | | | | MUST be PG_BUSY. It is bogus to free a page that isn't busy, because it is in a state of being "unavailable" when being freed. The additional advantage is that the page_remove code has a better cross-check that the page should be busy and unavailable for other use. There were some minor problems with the collapse code, and this plugs those subtile "holes." Also, the vfs_bio code wasn't checking correctly for PG_BUSY pages. I am going to develop a more consistant scheme for grabbing pages, busy or otherwise. For now, we are stuck with the current morass.
* VM level code cleanups.dyson1998-01-221-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Start using TSM. Struct procs continue to point to upages structure, after being freed. Struct vmspace continues to point to pte object and kva space for kstack. u_map is now superfluous. 2) vm_map's don't need to be reference counted. They always exist either in the kernel or in a vmspace. The vmspaces are managed by reference counts. 3) Remove the "wired" vm_map nonsense. 4) No need to keep a cache of kernel stack kva's. 5) Get rid of strange looking ++var, and change to var++. 6) Change more data structures to use our "zone" allocator. Added struct proc, struct vmspace and struct vnode. This saves a significant amount of kva space and physical memory. Additionally, this enables TSM for the zone managed memory. 7) Keep ioopt disabled for now. 8) Remove the now bogus "single use" map concept. 9) Use generation counts or id's for data structures residing in TSM, where it allows us to avoid unneeded restart overhead during traversals, where blocking might occur. 10) Account better for memory deficits, so the pageout daemon will be able to make enough memory available (experimental.) 11) Fix some vnode locking problems. (From Tor, I think.) 12) Add a check in ufs_lookup, to avoid lots of unneeded calls to bcmp. (experimental.) 13) Significantly shrink, cleanup, and make slightly faster the vm_fault.c code. Use generation counts, get rid of unneded collpase operations, and clean up the cluster code. 14) Make vm_zone more suitable for TSM. This commit is partially as a result of discussions and contributions from other people, including DG, Tor Egge, PHK, and probably others that I have forgotten to attribute (so let me know, if I forgot.) This is not the infamous, final cleanup of the vnode stuff, but a necessary step. Vnode mgmt should be correct, but things might still change, and there is still some missing stuff (like ioopt, and physical backing of non-merged cache files, debugging of layering concepts.)
* Tie up some loose ends in vnode/object management. Remove an unneededdyson1998-01-171-16/+23
| | | | | | | config option in pmap. Fix a problem with faulting in pages. Clean-up some loose ends in swap pager memory management. The system should be much more stable, but all subtile bugs aren't fixed yet.
* Support running with inadequate swap space. Additionally, the codedyson1997-12-241-6/+14
| | | | will complain with a suggestion of increasing it.
* In all such uses of struct buf: 's/b_un.b_addr/b_data/g'phk1997-12-021-2/+2
|
* Removed unused #includes.bde1997-09-011-5/+1
|
* Print a device number in hex instead of decimal.bde1997-09-011-2/+2
|
* Fixed type mismatches for functions with args of type vm_prot_t and/orbde1997-08-251-6/+3
| | | | | | | | | vm_inherit_t. These types are smaller than ints, so the prototypes should have used the promoted type (int) to match the old-style function definitions. They use just vm_prot_t and/or vm_inherit_t. This depends on gcc features to work. I fixed the definitions since this is easiest. The correct fix may be to change the small types to u_int, to optimize for time instead of space.
OpenPOWER on IntegriCloud