summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Add MAP_NOSYNC feature to mmap(), and MADV_NOSYNC and MADV_AUTOSYNC todillon1999-12-128-21/+82
| | | | | | | | | | | | | | | | | madvise(). This feature prevents the update daemon from gratuitously flushing dirty pages associated with a mapped file-backed region of memory. The system pager will still page the memory as necessary and the VM system will still be fully coherent with the filesystem. Modifications made by other means to the same area of memory, for example by write(), are unaffected. The feature works on a page-granularity basis. MAP_NOSYNC allows one to use mmap() to share memory between processes without incuring any significant filesystem overhead, putting it in the same performance category as SysV Shared memory and anonymous memory. Reviewed by: julian, alc, dg
* Lock reporting and assertion changes.eivind1999-12-112-2/+2
| | | | | | | | | | | | | | | * lockstatus() and VOP_ISLOCKED() gets a new process argument and a new return value: LK_EXCLOTHER, when the lock is held exclusively by another process. * The ASSERT_VOP_(UN)LOCKED family is extended to use what this gives them * Extend the vnode_if.src format to allow more exact specification than locked/unlocked. This commit should not do any semantic changes unless you are using DEBUG_VFS_LOCKS. Discussed with: grog, mch, peter, phk Reviewed by: peter
* User ldt sharing.luoqi1999-12-061-1/+16
|
* Report swapdevices as cdevs rather than bdevs.phk1999-11-291-1/+1
| | | | Remove unused dev2budev() function.
* Remove nonsensical vm_map_{clear,set}_recursive() callsalc1999-11-251-3/+0
| | | | | | | from vm_map_pageable(). At the point they called, vm_map_pageable() holds a read (or shared) lock on the map. The purpose of vm_map_{clear,set}_recursive() is to disable/enable repeated write (or exclusive) lock requests by the same process.
* Correct the following error: vm_map_pageable() on a COW'ed (post-fork)alc1999-11-231-4/+5
| | | | | | | vm_map always failed because vm_map_lookup() looked at "vm_map_entry->wired_count" instead of "(vm_map_entry->eflags & MAP_ENTRY_USER_WIRED)". The effect was that many page wiring operations by sysctl were (silently) failing.
* Isolate the swapdev_vp "not quite" vnode in the only source file whichphk1999-11-222-35/+11
| | | | | | needs it now that /dev/drum is gone. Reviewed by: eivind, peter
* Remove the non-functional "swap device" userland front-end to thepeter1999-11-183-82/+14
| | | | | | | | | | | | | | | | | | | | | multiplexed underlying swap devices (/dev/drum). The only thing it did was to allow root to open /dev/drum, but not do anything with it. Various utilities used to grovel around in here, but Matt has written a much nicer (and clean) front-end to this for libkvm, and nothing uses the old system any more. The VM system was calling VOP_STRATEGY() on the vp of the first underlying swap device (not the /dev/drum one, the first real device), and using the VOP system to indirectly (and only) call swstrategy() to choose an underlying device and enqueue it on that device. I have changed it to avoid diverting through the VOP system and to call the only possible target directly, saving a little bit of time and some complexity. In all, nothing much changes, except some scaffolding to support the roundabout way of calling swstrategy() is gone. Matt gave me the ok to do this some time ago, and I apologize for taking so long to get around to it.
* Two changes: (1) Use vm_page_unqueue_nowakeup in vm_page_allocalc1999-11-101-11/+2
| | | | | | | instead of duplicating the code. (2) If a wired page is passed to vm_page_free_toq, panic instead of printing a friendly warning. (If we don't panic here, we'll just panic later in vm_page_unwire obscuring the problem.)
* Remove unused declarations.alc1999-11-081-4/+0
|
* Remove unused #include's.alc1999-11-074-5/+0
| | | | Submitted by: phk
* The functions declared by this header file no longer exist.alc1999-11-073-42/+0
| | | | Submitted by: phk (in part)
* Reverse the sense of the test in the KASSERT's from the last commit.alc1999-10-301-2/+2
|
* The core of this patch is to vm/vm_page.h. The effects are two-fold: (1) toalc1999-10-303-78/+58
| | | | | | | | | eliminate an extra (useless) level of indirection in half of the page queue accesses and (2) to use a single name for each queue throughout, instead of, e.g., "vm_page_queue_active" in some places and "vm_page_queues[PQ_ACTIVE]" in others. Reviewed by: dillon
* Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for thephk1999-10-301-2/+8
| | | | | | | | | "rw" argument, rather than hijacking B_{READ|WRITE}. Fix two bugs (physio & cam) resulting by the confusion caused by this. Submitted by: Tor.Egge@fast.no Reviewed by: alc, ken (partly)
* useracc() the prequel:phk1999-10-2920-201/+44
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* Remove the last vestiges of "vm_map_t phys_map". It's been unusedalc1999-10-293-4/+0
| | | | since i386/i386/machdep.c rev 1.45 (or 1994 :-) ).
* Shrink "struct vm_object" by not spending a full 32 bitsalc1999-10-271-2/+2
| | | | on "objtype_t".
* Fix a panic(8) implementation:phk1999-10-081-5/+17
| | | | | | | hexdump -C < /dev/drum by simply refusing to do I/O from userland. a panic. I'm not sure we even need /dev/drum anymore, it seems to have been broken for a long time thi
* Introduce swopen to prevent blockdevice opens and insist on minor==0.phk1999-10-041-1/+17
|
* Give the swap device a D_DISK flag against my better judgement.phk1999-10-041-1/+1
| | | | TODO: add an open routing which fails for bdev opens.
* Plug an accounting leak: count pages in ZONE_INTERRUPT zones as wired.dt1999-09-301-0/+2
|
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | have been there in the first place. A GENERIC kernel shrinks almost 1k. Add a slightly different safetybelt under nostop for tty drivers. Add some missing FreeBSD tags
* cleanup madvise code, add a few more sanity checks.dillon1999-09-213-50/+89
| | | | Reviewed by: Alan Cox <alc@cs.rice.edu>, dg@root.com
* Final commit to remove vnode->v_lastr. vm_fault now handles readdillon1999-09-211-36/+43
| | | | | | | | | | | | | | | clustering issues (replacing code that used to be in ufs/ufs/ufs_readwrite.c). vm_fault also now uses the new VM page counter inlines. This completes the changeover from vnode->v_lastr to vm_entry_t->v_lastr for VM, and fp->f_nextread and fp->f_seqcount (which have been in the tree for a while). Determination of the I/O strategy (sequential, random, and so forth) is now handled on a descriptor-by-descriptor basis for base I/O calls, and on a memory-region-by-memory-region and process-by-process basis for VM faults. Reviewed by: David Greenman <dg@root.com>, Alan Cox <alc@cs.rice.edu>
* Fix bug in pipe code relating to writes of mmap'd but illegal addressdillon1999-09-201-1/+1
| | | | | | | | | spaces which cross a segment boundry in the page table. pmap_kextract() is not designed for access to the user space portion of the page table and cannot handle the null-page-directory-entry case. The fix is to have vm_fault_quick() return a success or failure which is then used to avoid calling pmap_kextract().
* Remove inappropriate VOP_FSYNC from vm_object_page_clean(). The fsyncdillon1999-09-171-2/+4
| | | | | | | | | | | | | | | | | syncs the entire underlying file rather then just the requested range, resulting in huge inefficiencies when the VM system is articulated in a certain way. The VOP_FSYNC was also found to massively reduce NFS performance in certain cases. Change MADV_DONTNEED and MADV_FREE to call vm_page_dontneed() instead of vm_page_deactivate(). Using vm_page_deactivate() causes all inactive and cache pages to be recycled before the dontneed/free page is recycled, effectively flushing our entire VM inactive & cache queues continuously even if only a few pages are being actively MADV free'd and reused (such as occurs with a sequential scan of a memory-mapped file). Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
* Add 'lastr' field to vm_map_entry in preparation for its removaldillon1999-09-171-0/+1
| | | | | | | from the vnode. (The changeover is undergoing final testing and will be committed soon). Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
* The vnode pager (used when you do file-backed mmaps) must use thedillon1999-09-171-3/+11
| | | | | | | | | | | | underlying physical sector size when aligning I/O transfer sizes. It cannot assume 512 bytes. We assume the underlying sector size is a power of 2. If it isn't, mmap() will break badly anyway (in the same way mmap broke with NFS when NFS tried to cache piecemeal write ranges in buffers, before we enforced read-buffer-before-write-piecemeal for NFS). Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
* Fix a number of spl bugs related to reserving and freeing swap space.dillon1999-09-172-292/+234
| | | | | | | | | | | | | | | | | | | | Swap space can be freed from an interrupt and so swap reservation and freeing must occur at splvm. Add swap_pager_reserve() code to support a new swap pre-reservation capability for the VN device. Generally cleanup the swap code by simplifying the swp_pager_meta_build() static function and consolidating the SWAPBLK_NONE test from a bit test to an absolute compare. The bit test was left over from a rejected swap allocation scheme that was not ultimately committed. A few other minor cleanups were also made. Reorganize the swap strategy code, again for VN support, to not reallocate swap when writing as this messes up pre-reservation and can fragment I/O unnecessarily as VN-baesd disk is messed around with. Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
* Add required BUF_KERNPROC to flushchainbuf() to disassociate thedillon1999-09-171-0/+1
| | | | | | | | current process from the exclusive lock prior to initiating I/O. This fixes a panic related to swap-backed VN disks Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
* Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>dillon1999-09-175-116/+188
| | | | | | | | | | | | | | | | Replace various VM related page count calculations strewn over the VM code with inlines to aid in readability and to reduce fragility in the code where modules depend on the same test being performed to properly sleep and wakeup. Split out a portion of the page deactivation code into an inline in vm_page.c to support vm_page_dontneed(). add vm_page_dontneed(), which handles the madvise MADV_DONTNEED feature in a related commit coming up for vm_map.c/vm_object.c. This code prevents degenerate cases where an essentially active page may be rotated through a subset of the paging lists, resulting in premature disposal.
* $Id$ -> $FreeBSD$peter1999-08-2834-34/+34
|
* Simplify the handling of VCHR and VBLK vnodes using the new dev_t:phk1999-08-261-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make the alias list a SLIST. Drop the "fast recycling" optimization of vnodes (including the returning of a prexisting but stale vnode from checkalias). It doesn't buy us anything now that we don't hardlimit vnodes anymore. Rename checkalias2() and checkalias() to addalias() and addaliasu() - which takes dev_t and udev_t arg respectively. Make the revoke syscalls use vcount() instead of VALIASED. Remove VALIASED flag, we don't need it now and it is faster to traverse the much shorter lists than to maintain the flag. vfs_mountedon() can check the dev_t directly, all the vnodes point to the same one. Print the devicename in specfs/vprint(). Remove a couple of stale LFS vnode flags. Remove unimplemented/unused LK_DRAINED;
* When the SYSINIT() was removed, it was replaced with a make_dev on-demandgreen1999-08-241-1/+2
| | | | | | | | | | | creation of /dev/drum via calling swapon. However, the make_dev has a bogus (insofar that it hasn't been added yet) cdevsw, so later we end up crashing with a null pointer dereference on the swap vp's specinfo. The specinfo points to a dev_t with a major of 254 (uninitialized), and we get a crash on its d_strategy being called. The simple solution to this is to call cdevsw_add before the make_dev is ever used. This fixes the panic which occurred upon swapping.
* 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.
* Convert DEVFS hooks in (most) drivers to make_dev().phk1999-08-231-33/+6
| | | | | | | | | | | | | | | | Diskslice/label code not yet handled. Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers) Add the correct hook for devfs to kern_conf.c The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases. A few drivers had minor additional cleanups performed relating to cdevsw registration. A few drivers don't register a cdevsw{} anymore, but only use make_dev().
* Correct the inconsistent formatting in struct vm_map.alc1999-08-231-2/+2
| | | | Addendum to rev 1.47: submitted by dillon.
* struct vm_map:alc1999-08-231-2/+9
| | | | | | The lock structure cannot be the first element of the vm_map because this can result in livelock between two or more system processes trying to kmem_alloc_wait.
* Remove two unused variable declarations.alc1999-08-221-3/+1
|
* vm_page_alloc and contigmalloc1:alc1999-08-201-3/+3
| | | | | | Verify that free pages are not dirty. Submitted by: dillon
* Update for run queue code.peter1999-08-191-2/+2
|
* Fix breakage - an extra brace got inserted where DIAGNOSTIC was definedmjacob1999-08-181-2/+1
| | | | but MAP_LOCK_DIAGNOSTIC wasn't.
* Unbreak the nfs KLD_MODULE. It needs a bit more of vm_page.h than wasgreen1999-08-171-3/+5
| | | | | exported (notably vm_page_undirty()). Also, let vm_page_dirty() work in a KLD.
* vm_page_free_toq:alc1999-08-171-10/+2
| | | | | Update the comment to reflect the demise of PQ_ZERO and remove a (now) useless test.
* Correct an accidental omission of one "vm_page_undirty" replacementalc1999-08-171-2/+2
| | | | from the previous commit.
* vm_page_free_toq:alc1999-08-171-1/+2
| | | | | | | Clear the dirty bit mask (vm_page_undirty) before adding the page to the free page queue. Submitted by: dillon
* Add the (inline) function vm_page_undirty for clearing the dirty bitmaskalc1999-08-173-6/+18
| | | | | | | | of a vm_page. Use it. Submitted by: dillon
* vm_pageout_clean:alc1999-08-171-27/+1
| | | | | | Remove dead code. Submitted by: dillon
* vm_map_lock*:alc1999-08-161-41/+52
| | | | | | | | Remove semicolons or add "do { } while (0)" as necessary to enable the use of these macros in arbitrary statements. (There are no functional changes.) Submitted by: dillon
OpenPOWER on IntegriCloud