summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_vnode.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove parenthesis around return value to reduce the diff with NetBSD.mpi2021-03-261-21/+21
| | | | | | No functional change. ok mlarkin@
* spellingjsg2021-03-121-2/+2
| | | | ok mpi@
* Bring back previous fix for UVM vnode deadlock.mpi2021-03-041-46/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | tb@ reports that refaulting when there's contention on the vnode makes firefox start very slowly on his machine. To revisit when the fault handler will be unlocked. ok anton@ Original commit message: Fix a deadlock between uvn_io() and uvn_flush(). While faulting on a page backed by a vnode, uvn_io() will end up being called in order to populate newly allocated pages using I/O on the backing vnode. Before performing the I/O, newly allocated pages are flagged as busy by uvn_get(), that is before uvn_io() tries to lock the vnode. Such pages could then end up being flushed by uvn_flush() which already has acquired the vnode lock. Since such pages are flagged as busy, uvn_flush() will wait for them to be flagged as not busy. This will never happens as uvn_io() cannot make progress until the vnode lock is released. Instead, grab the vnode lock before allocating and flagging pages as busy in uvn_get(). This does extend the scope in uvn_get() in which the vnode is locked but resolves the deadlock. ok mpi@ Reported-by: syzbot+e63407b35dff08dbee02@syzkaller.appspotmail.com
* Fix the deadlock between uvn_io() and uvn_flush() by restarting the fault.mpi2021-03-021-4/+8
| | | | | | | | | Do not allow a faulting thread to sleep on a contended vnode lock to prevent lock ordering issues with upcoming per-uobj lock. ok anton@ Reported-by: syzbot+e63407b35dff08dbee02@syzkaller.appspotmail.com
* Revert the fix for the deadlock between uvn_io() and uvn_flush().mpi2021-03-021-93/+43
| | | | | | | | This fix (ab)use the vnode lock to serialize access to some fields of the corresponding pages associated with UVM vnode object and this will create new deadlocks with the introduction of a per-uobj lock. ok anton@
* Fix a deadlock between uvn_io() and uvn_flush(). While faulting on aanton2020-10-261-43/+93
| | | | | | | | | | | | | | | | | | | | page backed by a vnode, uvn_io() will end up being called in order to populate newly allocated pages using I/O on the backing vnode. Before performing the I/O, newly allocated pages are flagged as busy by uvn_get(), that is before uvn_io() tries to lock the vnode. Such pages could then end up being flushed by uvn_flush() which already has acquired the vnode lock. Since such pages are flagged as busy, uvn_flush() will wait for them to be flagged as not busy. This will never happens as uvn_io() cannot make progress until the vnode lock is released. Instead, grab the vnode lock before allocating and flagging pages as busy in uvn_get(). This does extend the scope in uvn_get() in which the vnode is locked but resolves the deadlock. ok mpi@ Reported-by: syzbot+e63407b35dff08dbee02@syzkaller.appspotmail.com
* Constify and use C99 initializer for "struct uvm_pagerops".mpi2020-10-211-12/+17
| | | | | | | | | While here put some KERNEL_ASSERT_LOCKED() in the functions called from the page fault handler. The removal of locking of `uobj' will need to be revisited and these are good indicator that something is missing and that many comments are lying. ok kettenis
* Use list for freeing pages in uvn_flush() to optimize freeing chunks ofkettenis2020-01-161-3/+10
| | | | | | contiguous pages. ok beck@
* Convert infinite sleeps to {m,t}sleep_nsec(9).mpi2019-12-081-2/+2
| | | | ok visa@, jca@
* R.I.P. UVM_WAIT(). Use tsleep_nsec(9) directly.cheloha2019-07-181-8/+9
| | | | | | | | | | | UVM_WAIT() doesn't provide much of a useful abstraction. All callers tsleep forever and no callers set PCATCH, so only 2 of 4 parameters are actually used. Might as well just use tsleep_nsec(9) directly and make the uvm code a bit less specialized. Suggested by mpi@. ok mpi@ visa@ millert@
* Insert the appropriate uvm_vnp_uncache(9) and uvm_vnp_setsize(9)helg2018-07-161-3/+7
| | | | | | | kernel calls to ensure that the UVM cache for memory mapped files is up to date. ok mpi@
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-021-3/+3
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-3/+3
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Unlock the NET_LOCK() before calling vn_lock(9) to avoid a lock orderingmpi2018-03-301-13/+16
| | | | | | issues with upcoming NFSnode's locks. ok visa@
* When we are rebooting, do not fail in uvn_io(). The vnodes arebluhm2018-03-081-3/+8
| | | | | | | | revoked while syncing disk, so the processes lose their executable pages. Instead of killing them with a SIGBUS after page fault, just sleep. This should prevent that init dies without pages followed by a kernel panic. initial diff from tedu@; OK deraadt@ tedu@
* Use the NET_LOCK() macro instead of handrolling it.mpi2017-08-121-3/+3
| | | | Tested by Hrvoje Popovski.
* Enable the NET_LOCK(), take 3.mpi2017-05-151-1/+13
| | | | | | Recursions are still marked as XXXSMP. ok deraadt@, bluhm@
* Mark uvm_sync_lock as vnode'ish for witness purposes, as it is takenguenther2017-05-031-2/+2
| | | | | | between mount locks and inode locks, which may been recorded in either order ok visa@
* Revert the NET_LOCK() and bring back pf's contention lock for release.mpi2017-03-171-13/+1
| | | | | | | | | For the moment the NET_LOCK() is always taken by threads running under KERNEL_LOCK(). That means it doesn't buy us anything except a possible deadlock that we did not spot. So make sure this doesn't happen, we'll have plenty of time in the next release cycle to stress test it. ok visa@
* Enable the NET_LOCK(), take 2.mpi2017-01-251-1/+13
| | | | | | Recursions are currently known and marked a XXXSMP. Please report any assert to bugs@
* move the vm_page struct from being stored in RB macro trees to RBT functionsdlg2016-09-161-3/+3
| | | | | | | vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and uvm_pmr_size. all these have been moved to RBT code. this should give us a decent chunk of code space back.
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-3/+3
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* delete a comment about gcc -Wuninitializedderaadt2015-08-271-4/+2
|
* fix indentationjsg2015-05-071-2/+2
| | | | ok miod@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* remove two useless and unused hash penalty definestedu2014-12-181-3/+1
|
* remove lock.h from uvm_extern.h. another holdover from the simpletonlocktedu2014-12-171-1/+2
| | | | | era. fix uvm including c files to include lock.h or atomic.h as necessary. ok deraadt
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-10/+10
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* Replace a plethora of historical protection options with justderaadt2014-11-161-9/+9
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* Chuck Cranor rescinded clauses in his licensejsg2014-07-111-7/+2
| | | | | | | | | | | | | on the 2nd of February 2011 in NetBSD. http://marc.info/?l=netbsd-source-changes&m=129658899212732&w=2 http://marc.info/?l=netbsd-source-changes&m=129659095515558&w=2 http://marc.info/?l=netbsd-source-changes&m=129659157916514&w=2 http://marc.info/?l=netbsd-source-changes&m=129665962324372&w=2 http://marc.info/?l=netbsd-source-changes&m=129666033625342&w=2 http://marc.info/?l=netbsd-source-changes&m=129666052825545&w=2 http://marc.info/?l=netbsd-source-changes&m=129666922906480&w=2 http://marc.info/?l=netbsd-source-changes&m=129667725518082&w=2
* Use real parameter types for u{dv,vn}_attach() instead of void *matthew2014-07-021-3/+2
| | | | ok guenther
* Fix some potential integer overflows caused by converting a page number intokettenis2014-05-081-3/+3
| | | | | | | | | | an offset/size/address by shifting by PAGE_SHIFT. Make uvm_objwrire/unwire use voff_t instead of off_t. The former is the right type here even if it is equivalent to the latter. Inspired by a somewhat similar changes in Bitrig. ok deraadt@, guenther@
* compress code by turning four line comments into one line comments.tedu2014-04-131-145/+26
| | | | emphatic ok usual suspects, grudging ok miod
* add IO_NOCACHE flag to vop_write arguments, which in turn sets B_NOCACHEbeck2014-04-081-2/+4
| | | | | | | on the written buffers. Use the flag for writes from the page daemon to ensure that we free buffers written out by the page daemon rather than caching them. ok kettenis@
* UVM_UNLOCK_AND_WAIT no longer unlocks, so rename it to UVM_WAIT.tedu2013-05-301-15/+8
|
* remove lots of comments about locking per beck's requesttedu2013-05-301-64/+22
|
* remove simple_locks from uvm code. ok beck deraadttedu2013-05-301-43/+1
|
* move the specfs code to a place people can see it; ok guenther thib krwderaadt2011-07-041-3/+2
|
* Replace inadvertantly removed line.oga2011-07-041-1/+2
| | | | | | | | now we can free vnodes again. ok gcc@, jetpack@, beck@, art@. (the results of this were hilarious)
* Rip out and burn support for UVM_HIST.oga2011-07-031-54/+3
| | | | | | | | The vm hackers don't use it, don't maintain it and have to look at it all the time. About time this 800 lines of code hit /dev/null. ``never liked it'' tedu@. ariane@ was very happy when i told her i wrote this diff.
* rename VFSDEBUG to VFLCKDEBUG;thib2011-07-021-3/+3
| | | | prompted by tedu@
* Use the current page not he first page when working out whether tooga2011-06-161-5/+3
| | | | | | | | | | | | | | | deactivate pages after syncing. While here, don't check flags for PQ_INACTIVE (this is the only place outside uvm_page.c where this is done) because pagedeactivate does this already. First part from Christian Ehrhart, second from me. Both ok ariane@. I meant to commit this about a week ago, but accidentally commited to my local cvs mirror then forgot about it.
* dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisdlg2010-05-181-1/+2
| | | | | | | | | | | gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
* Right now, if anything internal changes with a uvm object, diverseoga2010-04-301-5/+2
| | | | | | | | | | | | places in the tree need to be touched to update the object initialisation with respect to that. So, make a function (uvm_initobj) that takes the refcount, object and pager ops and does this initialisation for us. This should save on maintainance in the future. looked good to fgs@. Tedu complained about the British spelling but OKed it anyway.
* reintroduce the uvm_tree commit.oga2009-08-061-26/+4
| | | | | | | | | | Now instead of the global object hashtable, we have a per object tree. Testing shows no performance difference and a slight code shrink. OTOH when locking is more fine grained this should be faster due to lock contention on uvm.hashlock. ok thib@, art@.
* Put the PG_RELEASED changes diff back in.oga2009-07-221-293/+82
| | | | | | | | This has has been tested very very thoroughly on all archs we have excepting 88k and 68k. Please see cvs log for the individual commit messages. ok beck@, thib@
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-091-9/+9
| | | | | | | | | | | which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
* date based reversion of uvm to the 4th May.oga2009-06-171-1/+1
| | | | | | | | | | | More backouts in line with previous ones, this appears to bring us back to a stable condition. A machine forced to 64mb of ram cycled 10GB through swap with this diff and is still running as I type this. Other tests by ariane@ and thib@ also seem to show that it's alright. ok deraadt@, thib@, ariane@
* Backout all the PG_RELEASED changes.oga2009-06-161-81/+253
| | | | | | | | | | This is for the same reason as the earlier backouts, to avoid the bug either added or exposed sometime around c2k9. This *should* be the last one. prompted by deraadt@ ok ariane@
* Backout pmemrange (which to most people is more well known as physmemariane2009-06-161-2/+2
| | | | | | allocator). "i can't see any obvious problems" oga