summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* - Don't directly adjust v_usecount, use vref() instead.jeff2005-03-141-3/+1
| | | | Sponsored by: Isilon Systems, Inc.
* - Retire OLOCK and OWANT. All callers hold the vnode lock when creatingjeff2005-03-141-17/+0
| | | | | | a vnode object. There has been an assert to prove this for some time. Sponsored by: Isilon Systems, Inc.
* - Don't acquire the vnode lock in destroy_vobject, assert that it hasjeff2005-03-131-2/+1
| | | | | | already been acquired by the caller. Sponsored by: Isilon Systems, Inc.
* Revert the first part of revision 1.114 and modify the second part. Onalc2005-02-241-3/+16
| | | | | architectures implementing uma_small_alloc() pages do not necessarily belong to the kmem object.
* Try to unbreak the vnode locking around vop_reclaim() (based mostly onphk2005-02-191-0/+2
| | | | | | | | | patch from kan@). Pull bufobj_invalbuf() out of vinvalbuf() and make g_vfs call it on close. This is not yet a generally safe function, but for this very specific use it is safe. This solves the problem with buffers not being flushed by unmount or after failed mount attempts.
* Well, it seems that I pre-maturely removed the "All rights reserved"bmilekic2005-02-167-13/+13
| | | | | | | | | | | | | | statement from some files, so re-add it for the moment, until the related legalese is sorted out. This change affects: sys/kern/kern_mbuf.c sys/vm/memguard.c sys/vm/memguard.h sys/vm/uma.h sys/vm/uma_core.c sys/vm/uma_dbg.c sys/vm/uma_dbg.h sys/vm/uma_int.h
* Make UMA set the overloaded page->object back to kmem_object forbmilekic2005-02-161-8/+2
| | | | | | | UMA_ZONE_REFCNT and UMA_ZONE_MALLOC zones, as the page(s) undoubtedly came from kmem_map for those two. Previously it would set it back to NULL for UMA_ZONE_REFCNT zones and although this was probably not fatal, it added MORE code for no reason.
* Rather than overloading the page->object field like UMA does, use insteadbmilekic2005-02-151-17/+13
| | | | | | | | | | | | | | | | | | an unused pageq queue reference in the page structure to stash a pointer to the MemGuard FIFO. Using the page->object field caused problems because when vm_map_protect() was called the second time to set VM_PROT_DEFAULT back onto a set of pages in memguard_map, the protection in the VM would be changed but the PMAP code would lazily not restore the PG_RW bit on the underlying pages right away (see pmap_protect()). So when a page fault finally occured and the VM noticed the faulting address corresponds to a page that _does_ have write access now, it would then call into PMAP to set back PG_RW (i386 case being discussed here). However, before it got to do that, an assertion on the object lock not being owned would get triggered, as the object of the faulting page would need to be locked but was overloaded by MemGuard. This is precisely why MemGuard cannot overload page->object. Submitted by: Alan Cox (alc@)
* sysctl node vm.stats can not be static (for ia64 reasons).phk2005-02-111-1/+1
|
* Implement support for buffers larger than PAGE_SIZE in MemGuard. Addsbmilekic2005-02-101-32/+129
| | | | | | | | | | | | | | a little bit of complexity but performance requirements lacking (this is a debugging allocator after all), it's really not too bad (still only 317 lines). Also add an additional check to help catch really weird 3-threads-involved races: make memguard_free() write to the first page handed back, always, before it does anything else. Note that there is still a problem in VM+PMAP (specifically with vm_map_protect) w.r.t. MemGuard uses it, but this will be fixed shortly and this change stands on its own.
* Make three SYSCTL_NODEs staticphk2005-02-101-3/+5
|
* Make npages static and const.phk2005-02-101-1/+1
|
* Set the scheduling class of the zeroidle thread to PRI_IDLE.ssouhlal2005-02-041-2/+5
| | | | | | Reviewed by: jhb Approved by: grehan (mentor) MFC after: 1 week
* Update the text of an assertion to reflect changes made in revision 1.148.alc2005-01-301-5/+1
| | | | | | | Submitted by: tegge Eliminate an unnecessary, temporary increment of the backing object's reference count in vm_object_qcollapse(). Reviewed by: tegge
* Move the contents of vop_stddestroyvobject() to the new vnode_pagerphk2005-01-281-0/+33
| | | | | | | function vnode_destroy_vobject(). Make the new function zero the vp->v_object pointer so we can tell if a call is missing.
* Don't use VOP_GETVOBJECT, use vp->v_object directly.phk2005-01-251-1/+2
|
* Move the body of vop_stdcreatevobject() over to the vnode_pager underphk2005-01-242-1/+50
| | | | | | | | | | | the name Sande^H^H^H^H^Hvnode_create_vobject(). Make the new function take a size argument which removes the need for a VOP_STAT() or a very pessimistic guess for disks. Call that new function from vop_stdcreatevobject(). Make vnode_pager_alloc() private now that its only user came home.
* Kill the VV_OBJBUF and test the v_object for NULL instead.phk2005-01-241-1/+1
|
* - Remove GIANT_REQUIRED where giant is no longer required.jeff2005-01-244-22/+29
| | | | | | | - Use VFS_LOCK_GIANT() rather than directly acquiring giant in places where giant is only held because vfs requires it. Sponsored By: Isilon Systems, Inc.
* Guard against address wrap in kernacc(). Otherwise, a program accessing aalc2005-01-221-0/+5
| | | | | | | | bad address range through /dev/kmem can panic the machine. Submitted by: Mark W. Krentel Reported by: Kris Kennaway MFC after: 1 week
* s/round_page/trunc_page/gbmilekic2005-01-221-4/+4
| | | | | | | I meant trunc_page. It's only a coincidence this hasn't caused problems yet. Pointed out by: Antoine Brodin <antoine.brodin@laposte.net>
* Bring in MemGuard, a very simple and small replacement allocatorbmilekic2005-01-212-0/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | designed to help detect tamper-after-free scenarios, a problem more and more common and likely with multithreaded kernels where race conditions are more prevalent. Currently MemGuard can only take over malloc()/realloc()/free() for particular (a) malloc type(s) and the code brought in with this change manually instruments it to take over M_SUBPROC allocations as an example. If you are planning to use it, for now you must: 1) Put "options DEBUG_MEMGUARD" in your kernel config. 2) Edit src/sys/kern/kern_malloc.c manually, look for "XXX CHANGEME" and replace the M_SUBPROC comparison with the appropriate malloc type (this might require additional but small/simple code modification if, say, the malloc type is declared out of scope). 3) Build and install your kernel. Tune vm.memguard_divisor boot-time tunable which is used to scale how much of kmem_map you want to allott for MemGuard's use. The default is 10, so kmem_size/10. ToDo: 1) Bring in a memguard(9) man page. 2) Better instrumentation (e.g., boot-time) of MemGuard taking over malloc types. 3) Teach UMA about MemGuard to allow MemGuard to override zone allocations too. 4) Improve MemGuard if necessary. This work is partly based on some old patches from Ian Dowse.
* Add checks to vm_map_findspace() to test for address wrap. The conditionsalc2005-01-181-4/+8
| | | | | | | where this could occur are very rare, but possible. Submitted by: Mark W. Krentel MFC after: 2 weeks
* Consider three objects, O, BO, and BBO, where BO is O's backing objectalc2005-01-151-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | and BBO is BO's backing object. Now, suppose that O and BO are being collapsed. Furthermore, suppose that BO has been marked dead (OBJ_DEAD) by vm_object_backing_scan() and that either vm_object_backing_scan() has been forced to sleep due to encountering a busy page or vm_object_collapse() has been forced to sleep due to memory allocation in the swap pager. If vm_object_deallocate() is then called on BBO and BO is BBO's only shadow object, vm_object_deallocate() will collapse BO and BBO. In doing so, it adds a necessary temporary reference to BO. If this collapse also sleeps and the prior collapse resumes first, the temporary reference will cause vm_object_collapse to panic with the message "backing_object %p was somehow re-referenced during collapse!" Resolve this race by changing vm_object_deallocate() such that it doesn't collapse BO and BBO if BO is marked dead. Once O and BO are collapsed, vm_object_collapse() will attempt to collapse O and BBO. So, vm_object_deallocate() on BBO need do nothing. Reported by: Peter Holm on 20050107 URL: http://www.holm.cc/stress/log/cons102.html In collaboration with: tegge@ Candidate for RELENG_4 and RELENG_5 MFC after: 2 weeks
* Eliminate unused and unnecessary "cred" argument from vinvalbuf()phk2005-01-141-1/+1
|
* Remove the unused credential argument from VOP_FSYNC() and VFS_SYNC().phk2005-01-111-1/+1
| | | | | | | | | | | | | | | | | | I'm not sure why a credential was added to these in the first place, it is not used anywhere and it doesn't make much sense: The credentials for syncing a file (ability to write to the file) should be checked at the system call level. Credentials for syncing one or more filesystems ("none") should be checked at the system call level as well. If the filesystem implementation needs a particular credential to carry out the syncing it would logically have to the cached mount credential, or a credential cached along with any delayed write data. Discussed with: rwatson
* While we want the recursion protection for the bucket zones so thatbmilekic2005-01-111-1/+11
| | | | | | | | | | | | | | | | | recursion from the VM is handled (and the calling code that allocates buckets knows how to deal with it), we do not want to prevent allocation from the slab header zones (slabzone and slabrefzone) if uk_recurse is not zero for them. The reason is that it could lead to NULL being returned for the slab header allocations even in the M_WAITOK case, and the caller can't handle that (this is also explained in a comment with this commit). The problem analysis is documented in our mailing lists: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=153445+0+archive/2004/freebsd-current/20041231.freebsd-current (see entire thread for proper context). Crash dump data provided by: Peter Holm <peter@holm.cc>
* ISO C requires at least one element in an initialiser list.stefanf2005-01-101-1/+1
|
* Move the acquisition and release of the page queues lock outside of a loopalc2005-01-081-2/+3
| | | | in vm_object_split() to avoid repeated acquisition and release.
* Transfer responsibility for freeing the page taken from the cachealc2005-01-071-19/+17
| | | | | | | | | | | queue and (possibly) unlocking the containing object from vm_page_alloc() to vm_page_select_cache(). Recent optimizations to vm_map_pmap_enter() (see vm_map.c revisions 1.362 and 1.363) and pmap_enter_quick() have resulted in panic()s because vm_page_alloc() mistakenly unlocked objects that had not been locked by vm_page_select_cache(). Reported by: Peter Holm and Kris Kennaway
* /* -> /*- for license, minor formatting changesimp2005-01-0734-36/+36
|
* Revise the part of vm_pageout_scan() that moves pages from the cachealc2005-01-061-12/+31
| | | | | | queue to the free queue. With this change, if a page from the cache queue belongs to a locked object, it is simply skipped over rather than moved to the inactive queue.
* When allocating bio's in the swap_pager use M_WAITOK since thephk2005-01-031-6/+7
| | | | alternative is much worse.
* Assert that page allocations during an interrupt specifyalc2004-12-311-2/+6
| | | | | | VM_ALLOC_INTERRUPT. Assert that pages removed from the cache queue are not busy.
* Access to the page's busy field is (now) synchronized by the containingalc2004-12-291-1/+0
| | | | | object's lock. Therefore, the assertion that the page queues lock is held can be removed from vm_page_io_start().
* Note that access to the page's busy count is synchronized by the containingalc2004-12-271-1/+1
| | | | object's lock.
* Assert that the vm object is locked on entry to vm_page_sleep_if_busy();alc2004-12-261-8/+3
| | | | remove some unneeded code.
* Add my copyright and update Jeff's copyright on UMA source files,bmilekic2004-12-265-10/+20
| | | | | | as per his request. Discussed with: Jeffrey Roberson
* fix commentphk2004-12-251-1/+1
|
* Continue the transition from synchronizing access to the page's PG_BUSYalc2004-12-241-11/+29
| | | | | | | | | flag and busy field with the global page queues lock to synchronizing their access with the containing object's lock. Specifically, acquire the containing object's lock before reading the page's PG_BUSY flag and busy field in vm_fault(). Reviewed by: tegge@
* Modify pmap_enter_quick() so that it expects the page queues to be lockedalc2004-12-232-7/+11
| | | | | | | | | | | on entry and it assumes the responsibility for releasing the page queues lock if it must sleep. Remove a bogus comment from pmap_enter_quick(). Using the first change, modify vm_map_pmap_enter() so that the page queues lock is acquired and released once, rather than each time that a page is mapped.
* Eliminate another unnecessary call to vm_page_busy(). (See revision 1.333alc2004-12-171-5/+0
| | | | for a detailed explanation.)
* Enable debug.mpsafevm by default on alpha.alc2004-12-171-1/+1
|
* In the common case, pmap_enter_quick() completes without sleeping.alc2004-12-152-17/+6
| | | | | | | | | | | | | | | | | | In such cases, the busying of the page and the unlocking of the containing object by vm_map_pmap_enter() and vm_fault_prefault() is unnecessary overhead. To eliminate this overhead, this change modifies pmap_enter_quick() so that it expects the object to be locked on entry and it assumes the responsibility for busying the page and unlocking the object if it must sleep. Note: alpha, amd64, i386 and ia64 are the only implementations optimized by this change; arm, powerpc, and sparc64 still conservatively busy the page and unlock the object within every pmap_enter_quick() call. Additionally, this change is the first case where we synchronize access to the page's PG_BUSY flag and busy field using the containing object's lock rather than the global page queues lock. (Modifications to the page's PG_BUSY flag and busy field have asserted both locks for several weeks, enabling an incremental transition.)
* With the removal of kern/uipc_jumbo.c and sys/jumbo.h,alc2004-12-082-22/+5
| | | | vm_object_allocate_wait() is not used. Remove it.
* Almost nine years ago, when support for 1TB files was introduced inalc2004-12-071-1/+1
| | | | | | | | | | | | | revision 1.55, the address parameter to vnode_pager_addr() was changed from an unsigned 32-bit quantity to a signed 64-bit quantity. However, an out-of-range check on the address was not updated. Consequently, memory-mapped I/O on files greater than 2GB could cause a kernel panic. Since the address is now a signed 64-bit quantity, the problem resolution is simply to remove a cast. Reviewed by: bde@ and tegge@ PR: 73010 MFC after: 1 week
* Correct a sanity check in vnode_pager_generic_putpages(). The cast usedalc2004-12-051-1/+1
| | | | | | | | | | to implement the sanity check should have been changed when we converted the implementation of vm_pindex_t from 32 to 64 bits. (Thus, RELENG_4 is not affected.) The consequence of this error would be a legimate write to an extremely large file being treated as an errant attempt to write meta- data. Discussed with: tegge@
* Don't include sys/user.h merely for its side-effect of recursivelydas2004-11-271-2/+0
| | | | including other headers.
* Remove useless casts.cognet2004-11-261-2/+2
|
* Try to close a potential, but serious race in our VM subsystem.delphij2004-11-241-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Historically, our contigmalloc1() and contigmalloc2() assumes that a page in PQ_CACHE can be unconditionally reused by busying and freeing it. Unfortunatelly, when object happens to be not NULL, the code will set m->object to NULL and disregard the fact that the page is actually in the VM page bucket, resulting in page bucket hash table corruption and finally, a filesystem corruption, or a 'page not in hash' panic. This commit has borrowed the idea taken from DragonFlyBSD's fix to the VM fix by Matthew Dillon[1]. This version of patch will do the following checks: - When scanning pages in PQ_CACHE, check hold_count and skip over pages that are held temporarily. - For pages in PQ_CACHE and selected as candidate of being freed, check if it is busy at that time. Note: It seems that this is might be unrelated to kern/72539. Obtained from: DragonFlyBSD, sys/vm/vm_contig.c,v 1.11 and 1.12 [1] Reminded by: Matt Dillon Reworked by: alc MFC After: 1 week
OpenPOWER on IntegriCloud