freebsd-dev/sys/vm
Konstantin Belousov 95e2409a33 Fix a LOR between vnode locks and allproc_lock.
There is an order between covered vnode lock and allproc_lock, which
is established by calling mountcheckdirs() while owning the covered
vnode lock. mountcheckdirs() iterates over the processes, protected by
allproc_lock.  This order is needed and seems to be not avoidable.

On the other hand, various VM daemons also need to iterate over all
processes, and they lock and unlock user maps.  Since unlock of the
user map may trigger processing of the deferred map entries, it causes
vnode locking to occur.  Or, when vmspace is freed, dropping references
on the vnode-backed object also lock vnodes.  We get reverted order
comparing with the mount/unmount order.

For VM daemons, there is no need to own allproc_lock while we operate
on vmspaces. If the process is held, it serves as the marker for
allproc list, which allows to continue the iteration.

Add _PHOLD_LITE() macro, similar to _PHOLD(), but not causing swap-in
of the kernel stacks.  It is used instead of _PHOLD() in vm code,
since e.g. calling faultin() in OOM conditions only exaggerates the
problem.

Modernize comment describing PHOLD.

Reported by:	lists@yamagi.org
Tested by:	pho (previous version)
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 week
Approved by:	re (gjb)
Differential revision:	https://reviews.freebsd.org/D6679
2016-06-22 20:15:37 +00:00
..
_vm_radix.h
default_pager.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
device_pager.c Avoid duplicated calls to pmap_page_get_memattr(). 2016-05-01 17:48:43 +00:00
memguard.c Include sys/_task.h into uma_int.h, so that taskqueue.h isn't a 2016-02-09 20:22:35 +00:00
memguard.h
phys_pager.c sys: use our roundup2/rounddown2() macros when param.h is available. 2016-04-21 19:57:40 +00:00
pmap.h Properly sort the function declarations added in r286296 2015-08-05 10:48:32 +00:00
redzone.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
redzone.h
sg_pager.c Plug a vm_page leak introduced in r292373. 2016-02-05 19:35:53 +00:00
swap_pager.c Fix inconsistent locking of the swap pager named objects list. 2016-06-13 03:42:46 +00:00
swap_pager.h
uma_core.c Fix memguard(9) in kernels with INVARIANTS enabled. 2016-06-01 22:31:35 +00:00
uma_dbg.c Fix memguard(9) in kernels with INVARIANTS enabled. 2016-06-01 22:31:35 +00:00
uma_dbg.h Move uma_dbg_alloc() and uma_dbg_free() into uma_core.c, which allows 2016-02-03 22:02:36 +00:00
uma_int.h sys/vm: minor spelling fixes in comments. 2016-05-02 20:16:29 +00:00
uma.h Remove UMA_ZONE_REFCNT feature, now unused. 2016-03-01 00:33:32 +00:00
vm_domain.c Move vm_domain_rr_selectdomain() under #ifdef VM_NUMA_ALLOC. 2016-05-10 22:25:55 +00:00
vm_domain.h Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
vm_extern.h Various cleanups to the main function for AIO kernel processes: 2016-01-19 21:37:51 +00:00
vm_fault.c Use vm_page_replace_checked() instead of vm_page_rename() for implementing 2016-05-27 06:05:12 +00:00
vm_glue.c Fix a LOR between vnode locks and allproc_lock. 2016-06-22 20:15:37 +00:00
vm_init.c Parallelize the buffer cache and rewrite getnewbuf(). This results in a 2015-10-14 02:10:07 +00:00
vm_kern.c Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_kern.h
vm_map.c sys/vm: minor spelling fixes in comments. 2016-05-02 20:16:29 +00:00
vm_map.h Do not pretend that vm_fault(9) supports unwiring the address. Rename 2015-07-30 18:28:34 +00:00
vm_meter.c The vmtotal sysctl handler marks active vm objects to calculate 2016-06-21 17:49:33 +00:00
vm_mmap.c Add a local variable initialization needed in the OBJT_DEFAULT case. 2015-07-05 22:26:19 +00:00
vm_object.c Do not leak the vm object lock when swap reservation failed, in 2016-05-29 15:46:19 +00:00
vm_object.h The vmtotal sysctl handler marks active vm objects to calculate 2016-06-21 17:49:33 +00:00
vm_page.c Reset the page busy lock state after failing to insert into the object. 2016-06-02 17:11:24 +00:00
vm_page.h vm/vm_page.h: Fix trivial '-Wpointer-sign' warning 2016-05-19 17:54:14 +00:00
vm_pageout.c Fix a LOR between vnode locks and allproc_lock. 2016-06-22 20:15:37 +00:00
vm_pageout.h The flag "vm_pages_needed" has long served two distinct purposes: (1) to 2016-05-27 19:15:45 +00:00
vm_pager.c Remove slightly used const values that can be replaced with nitems(). 2016-04-21 15:38:28 +00:00
vm_pager.h A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
vm_param.h Remove the v_cache_min and v_cache_max sysctls. They are unused and have 2015-09-11 03:00:20 +00:00
vm_phys.c sys: use our roundup2/rounddown2() macros when param.h is available. 2016-04-21 19:57:40 +00:00
vm_phys.h Add more fine-grained kernel options for NUMA support. 2016-04-09 13:58:04 +00:00
vm_radix.c Cleanup redundant parenthesis from existing howmany()/roundup() macro uses. 2016-04-22 16:57:42 +00:00
vm_radix.h
vm_reserv.c Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_reserv.h Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_unix.c Implement lockless resource limits. 2015-06-10 10:48:12 +00:00
vm_zeroidle.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
vm.h Add new bus methods for mapping resources. 2016-05-20 17:57:47 +00:00
vnode_pager.c Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
vnode_pager.h A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00