summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup OBJ_ONEMAPPING management.alc1999-07-112-15/+5
| | | | | | | | | | | | vm_map.c: Don't set OBJ_ONEMAPPING on arbitrary vm objects. Only default and swap type vm objects should have it set. vm_object_deallocate already handles these cases. vm_object.c: If OBJ_ONEMAPPING isn't already clear in vm_object_shadow, we are in trouble. Instead of clearing it, make it an assertion that it is already clear.
* Change the data type used to represent page color in the vm_objectalc1999-07-101-2/+2
| | | | | to be the same as that used in the vm_page. (This change also shrinks the vm_object.)
* Remove unused function prototypes.alc1999-07-101-3/+1
|
* add unused argument to udev2dev() to make kernel compiledache1999-07-071-2/+2
|
* Reinstate the previous fix for the broken export of a dev_t in sw_dev, convertmsmith1999-07-071-3/+3
| | | | back to a dev_t when the value is actually used.
* Back out previous commit. It was wrong, and caused panics.green1999-07-071-1/+1
|
* swdevt should contain a udev_t not a devt. This resulted in bogusmsmith1999-07-061-2/+2
| | | | | | swap device name reporting. Submitted by: Bill Swingle <unfurl@freebsd.org>
* Reformat previous fix to remove an uglier than average goto.mckay1999-07-051-9/+11
| | | | Looked OK to: dg
* The buffer queue mechanism has been reformulated. Instead of havingmckusick1999-07-042-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUEUE_AGE, QUEUE_LRU, and QUEUE_EMPTY we instead have QUEUE_CLEAN, QUEUE_DIRTY, QUEUE_EMPTY, and QUEUE_EMPTYKVA. With this patch clean and dirty buffers have been separated. Empty buffers with KVM assignments have been separated from truely empty buffers. getnewbuf() has been rewritten and now operates in a 100% optimal fashion. That is, it is able to find precisely the right kind of buffer it needs to allocate a new buffer, defragment KVM, or to free-up an existing buffer when the buffer cache is full (which is a steady-state situation for the buffer cache). Buffer flushing has been reorganized. Previously buffers were flushed in the context of whatever process hit the conditions forcing buffer flushing to occur. This resulted in processes blocking on conditions unrelated to what they were doing. This also resulted in inappropriate VFS stacking chains due to multiple processes getting stuck trying to flush dirty buffers or due to a single process getting into a situation where it might attempt to flush buffers recursively - a situation that was only partially fixed in prior commits. We have added a new daemon called the buf_daemon which is responsible for flushing dirty buffers when the number of dirty buffers exceeds the vfs.hidirtybuffers limit. This daemon attempts to dynamically adjust the rate at which dirty buffers are flushed such that getnewbuf() calls (almost) never block. The number of nbufs and amount of buffer space is now scaled past the 8MB limit that was previously imposed for systems with over 64MB of memory, and the vfs.{lo,hi}dirtybuffers limits have been relaxed somewhat. The number of physical buffers has been increased with the intention that we will manage physical I/O differently in the future. reassignbuf previously attempted to keep the dirtyblkhd list sorted which could result in non-deterministic operation under certain conditions, such as when a large number of dirty buffers are being managed. This algorithm has been changed. reassignbuf now keeps buffers locally sorted if it can do so cheaply, and otherwise gives up and adds buffers to the head of the dirtyblkhd list. The new algorithm is deterministic but not perfect. The new algorithm greatly reduces problems that previously occured when write_behind was turned off in the system. The P_FLSINPROG proc->p_flag bit has been replaced by the more descriptive P_BUFEXHAUST bit. This bit allows processes working with filesystem buffers to use available emergency reserves. Normal processes do not set this bit and are not allowed to dig into emergency reserves. The purpose of this bit is to avoid low-memory deadlocks. A small race condition was fixed in getpbuf() in vm/vm_pager.c. Submitted by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Kirk McKusick <mckusick@mckusick.com>
* Fix some int/long printf problems for the Alphapeter1999-07-015-20/+23
|
* Slight reorganization of kernel thread/process creation. Instead of usingpeter1999-07-011-3/+4
| | | | | | | | | | | | | | | SYSINIT_KT() etc (which is a static, compile-time procedure), use a NetBSD-style kthread_create() interface. kproc_start is still available as a SYSINIT() hook. This allowed simplification of chunks of the sysinit code in the process. This kthread_create() is our old kproc_start internals, with the SYSINIT_KT fork hooks grafted in and tweaked to work the same as the NetBSD one. One thing I'd like to do shortly is get rid of nfsiod as a user initiated process. It makes sense for the nfs client code to create them on the fly as needed up to a user settable limit. This means that nfsiod doesn't need to be in /sbin and is always "available". This is a fair bit easier to do outside of the SYSINIT_KT() framework.
* 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.
* Minor tweaks to make sure (new) prerequisites for <sys/buf.h> (mostlypeter1999-06-271-2/+3
| | | | splbio()/splx()) are #included in time.
* There isn't much point waking up a daemon that hasn't existed sincepeter1999-06-261-6/+2
| | | | softupdates came in. Try calling speedup_syncer() instead..
* Convert buffer locking from using the B_BUSY and B_WANTED flags to usingmckusick1999-06-264-18/+22
| | | | | | | 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 (1) "extern" declarations for variables that were previouslyalc1999-06-223-54/+5
| | | | made "static" and (2) initialized but unused variables.
* Remove vm_object::cache_count and vm_object::wired_count. They arealc1999-06-203-32/+3
| | | | | | not used. (Nor is there any planned use by John who introduced them.) Reviewed by: "John S. Dyson" <toor@dyson.iquest.net>
* Set cnt.v_page_size to PAGE_SIZE rather than DEFAULT_PAGE_SIZE so thatalc1999-06-202-5/+5
| | | | | | "vmstat -s" reports the correct value on the Alpha. Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
* Remove some unused function and variable declarations.alc1999-06-194-43/+4
|
* vm_map_growstack uses vmspace::vm_ssize as though it containedalc1999-06-171-6/+6
| | | | the stack size in bytes when in fact it is the stack size in pages.
* vm_map_insert sometimes extends an existing vm_map entry, rather thanalc1999-06-171-3/+7
| | | | | | | creating a new entry. vm_map_stack and vm_map_growstack can panic when a new entry isn't created. Fixed vm_map_stack and vm_map_growstack. Also, when extending the stack, always set the protection to VM_PROT_ALL.
* Move vm_map_stack and vm_map_growstack after the definitionalc1999-06-171-204/+204
| | | | | of the vm_map_clip_end macro. (The next commit will modify vm_map_stack and vm_map_growstack to use vm_map_clip_end.)
* Remove some unused declarations and duplicate initialization.alc1999-06-171-6/+2
|
* vm_map_protect:alc1999-06-121-2/+2
| | | | | The wrong vm_map_entry is used to determine if writes must not be allowed due to COW.
* Add a function kmem_alloc_nofault() - same as kmem_alloc_pageable(), butdt1999-06-082-2/+27
| | | | | | create a nofault entry. It will be used to allocate kmem for upages. (I am not too happy with all this, but it's better than nothing).
* vm_mmap:alc1999-06-051-3/+4
| | | | | | | Insure that device mappings get MAP_PREFAULT(_PARTIAL) set, so that 4M page mappings are used when possible. Reviewed by: Luoqi Chen <luoqi@watermarkgroup.com>
* Shorten a detour around dev_t to get a udev_t created.phk1999-06-011-3/+2
|
* Simplify cdevsw registration.phk1999-05-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-7/+22
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* Addendum to 1.155. Verify the existence of the object before checkingalc1999-05-301-2/+3
| | | | its reference count.
* Avoid the creation of unnecessary shadow objects.alc1999-05-282-4/+20
|
* vm_map_insert:alc1999-05-181-47/+38
| | | | | General cleanup. Eliminate coalescing checks that are duplicated by vm_object_coalesce.
* Add the options MAP_PREFAULT and MAP_PREFAULT_PARTIAL to vm_map_find/insert,alc1999-05-173-12/+11
| | | | | | | eliminating the need for the pmap_object_init_pt calls in imgact_* and mmap. Reviewed by: David Greenman <dg@root.com>
* Remove prototypes for functions that don't exist anymore (vm_map.h).alc1999-05-164-28/+22
| | | | | | | | | | | | | | | | Remove a useless argument from vm_map_madvise's interface (vm_map.c, vm_map.h, and vm_mmap.c). Remove a redundant test in vm_uiomove (vm_map.c). Make two changes to vm_object_coalesce: 1. Determine whether the new range of pages actually overlaps the existing object's range of pages before calling vm_object_page_remove. (Prior to this change almost 90% of the calls to vm_object_page_remove were to remove pages that were beyond the end of the object.) 2. Free any swap space allocated to removed pages.
* Fix confusion of size of transfer with size of the pager.dt1999-05-151-3/+4
| | | | | PR: 11658 Broken in: 1.89 (1998/03/07)
* Simplify vm_map_find/insert's interface: remove the MAP_COPY_NEEDED option.alc1999-05-143-11/+9
| | | | | | | It never makes sense to specify MAP_COPY_NEEDED without also specifying MAP_COPY_ON_WRITE, and vice versa. Thus, MAP_COPY_ON_WRITE suffices. Reviewed by: David Greenman <dg@root.com>
* Casting handles from void * to uintptr_t on the way to dev_t becamebde1999-05-131-3/+3
| | | | especially bogus when dev_t became a pointer.
* Device pager's handle is dev_t not udev_t.luoqi1999-05-131-3/+3
|
* Fix a udev_t/dev_t mismatch which prevent paging from working.phk1999-05-121-2/+2
|
* Divorce "dev_t" from the "major|minor" bitmap, which is now calledphk1999-05-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
* No point in swapdev being a static global when used only locally.phk1999-05-091-2/+2
|
* I got tired of seeing all the cdevsw[major(foo)] all over the place.phk1999-05-082-7/+7
| | | | | | | | Made a new (inline) function devsw(dev_t dev) and substituted it. Changed to the BDEV variant to this format as well: bdevsw(dev_t dev) DEVFS will eventually benefit from this change too.
* Continue where Julian left off in July 1998:phk1999-05-071-4/+4
| | | | | | | | | | | | | | Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline) function. Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention to the order of the cmaj/bmaj arguments!) Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE (ditto!) (Next step will be to convert all bdev dev_t's to cdev dev_t's before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
* Introduce two functions: physread() and physwrite() and use these directlyphk1999-05-071-16/+2
| | | | | | in *devsw[] rather than the 46 local copies of the same functions. (grog will do the same for vinum when he has time)
* Add brackets to silence egcs and help clarity.peter1999-05-061-3/+3
|
* remove b_proc from struct buf, it's (now) unused.phk1999-05-063-14/+8
| | | | Reviewed by: dillon, bde
* Don't ignore mmap() address hint below the text section.luoqi1999-05-061-2/+4
|
* Add sysctl descriptions to many SYSCTL_XXXsbillf1999-05-031-7/+9
| | | | | | | PR: kern/11197 Submitted by: Adrian Chadd <adrian@FreeBSD.org> Reviewed by: billf(spelling/style/minor nits) Looked at by: bde(style)
* The VFS/BIO subsystem contained a number of hacks in order to optimizealc1999-05-026-22/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | piecemeal, middle-of-file writes for NFS. These hacks have caused no end of trouble, especially when combined with mmap(). I've removed them. Instead, NFS will issue a read-before-write to fully instantiate the struct buf containing the write. NFS does, however, optimize piecemeal appends to files. For most common file operations, you will not notice the difference. The sole remaining fragment in the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache coherency issues with read-merge-write style operations. NFS also optimizes the write-covers-entire-buffer case by avoiding the read-before-write. There is quite a bit of room for further optimization in these areas. The VM system marks pages fully-valid (AKA vm_page_t->valid = VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault. This is not correct operation. The vm_pager_get_pages() code is now responsible for marking VM pages all-valid. A number of VM helper routines have been added to aid in zeroing-out the invalid portions of a VM page prior to the page being marked all-valid. This operation is necessary to properly support mmap(). The zeroing occurs most often when dealing with file-EOF situations. Several bugs have been fixed in the NFS subsystem, including bits handling file and directory EOF situations and buf->b_flags consistancy issues relating to clearing B_ERROR & B_INVAL, and handling B_DONE. getblk() and allocbuf() have been rewritten. B_CACHE operation is now formally defined in comments and more straightforward in implementation. B_CACHE for VMIO buffers is based on the validity of the backing store. B_CACHE for non-VMIO buffers is based simply on whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear, and vise-versa). biodone() is now responsible for setting B_CACHE when a successful read completes. B_CACHE is also set when a bdwrite() is initiated and when a bwrite() is initiated. VFS VOP_BWRITE routines (there are only two - nfs_bwrite() and bwrite()) are now expected to set B_CACHE. This means that bowrite() and bawrite() also set B_CACHE indirectly. There are a number of places in the code which were previously using buf->b_bufsize (which is DEV_BSIZE aligned) when they should have been using buf->b_bcount. These have been fixed. getblk() now clears B_DONE on return because the rest of the system is so bad about dealing with B_DONE. Major fixes to NFS/TCP have been made. A server-side bug could cause requests to be lost by the server due to nfs_realign() overwriting other rpc's in the same TCP mbuf chain. The server's kernel must be recompiled to get the benefit of the fixes. Submitted by: Matthew Dillon <dillon@apollo.backplane.com>
* s/static foo_devsw_installed = 0;/static int foo_devsw_installed;/.dt1999-04-281-2/+2
| | | | (Edited automatically)
OpenPOWER on IntegriCloud