freebsd-skq/sys/vm
alc d1bce06c64 Change the management of cached pages (PQ_CACHE) in two fundamental
ways:

(1) Cached pages are no longer kept in the object's resident page
splay tree and memq.  Instead, they are kept in a separate per-object
splay tree of cached pages.  However, access to this new per-object
splay tree is synchronized by the _free_ page queues lock, not to be
confused with the heavily contended page queues lock.  Consequently, a
cached page can be reclaimed by vm_page_alloc(9) without acquiring the
object's lock or the page queues lock.

This solves a problem independently reported by tegge@ and Isilon.
Specifically, they observed the page daemon consuming a great deal of
CPU time because of pages bouncing back and forth between the cache
queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE).  The source of
this problem turned out to be a deadlock avoidance strategy employed
when selecting a cached page to reclaim in vm_page_select_cache().
However, the root cause was really that reclaiming a cached page
required the acquisition of an object lock while the page queues lock
was already held.  Thus, this change addresses the problem at its
root, by eliminating the need to acquire the object's lock.

Moreover, keeping cached pages in the object's primary splay tree and
memq was, in effect, optimizing for the uncommon case.  Cached pages
are reclaimed far, far more often than they are reactivated.  Instead,
this change makes reclamation cheaper, especially in terms of
synchronization overhead, and reactivation more expensive, because
reactivated pages will have to be reentered into the object's primary
splay tree and memq.

(2) Cached pages are now stored alongside free pages in the physical
memory allocator's buddy queues, increasing the likelihood that large
allocations of contiguous physical memory (i.e., superpages) will
succeed.

Finally, as a result of this change long-standing restrictions on when
and where a cached page can be reclaimed and returned by
vm_page_alloc(9) are eliminated.  Specifically, calls to
vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and
return a formerly cached page.  Consequently, a call to malloc(9)
specifying M_NOWAIT is less likely to fail.

Discussed with: many over the course of the summer, including jeff@,
   Justin Husted @ Isilon, peter@, tegge@
Tested by: an earlier version by kris@
Approved by: re (kensmith)
2007-09-25 06:25:06 +00:00
..
default_pager.c
device_pager.c Remove comment that is no longer quite true. 2007-08-18 16:41:31 +00:00
memguard.c
memguard.h
phys_pager.c Fix the phys_pager in the way similar to the rev. 1.83 of the 2007-08-18 16:40:33 +00:00
pmap.h Complete the transition from pmap_page_protect() to pmap_remove_write(). 2006-08-01 19:06:06 +00:00
redzone.c
redzone.h
swap_pager.c Consider a scenario in which one processor, call it Pt, is performing 2007-08-05 21:04:32 +00:00
swap_pager.h - Move 'struct swdevt' back into swap_pager.h and expose it to userland. 2007-02-07 17:43:11 +00:00
uma_core.c Revert VMCNT_* operations introduction. 2007-05-31 22:52:15 +00:00
uma_dbg.c
uma_dbg.h
uma_int.h Update stale comment on protecting UMA per-CPU caches: we now use 2007-05-09 22:53:34 +00:00
uma.h Add uma_set_align() interface, which will be called at most once during 2007-02-11 20:13:52 +00:00
vm_contig.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_extern.h Close race between vmspace_exitfree() and exit1() and races between 2006-05-29 21:28:56 +00:00
vm_fault.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_glue.c - Redefine p_swtime and td_slptime as p_swtick and td_slptick. This 2007-09-21 05:07:07 +00:00
vm_init.c
vm_kern.c When KVA is exhausted, try the vm_lowmem event for the last time before 2007-04-05 20:52:51 +00:00
vm_kern.h The clean_map has been made local to vm_init.c long ago. 2006-11-20 16:23:34 +00:00
vm_map.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_map.h Do not drop vm_map lock between doing vm_map_remove() and vm_map_insert(). 2007-08-20 12:05:45 +00:00
vm_meter.c Add a counter for the total number of pages cached and support for 2007-07-27 20:01:22 +00:00
vm_mmap.c Do not drop vm_map lock between doing vm_map_remove() and vm_map_insert(). 2007-08-20 12:05:45 +00:00
vm_object.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_object.h Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_page.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_page.h Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_pageout.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_pageout.h
vm_pageq.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_pager.c Consider a scenario in which one processor, call it Pt, is performing 2007-08-05 21:04:32 +00:00
vm_pager.h
vm_param.h Correct two comments. 2007-04-19 04:52:47 +00:00
vm_phys.c Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_phys.h Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00
vm_unix.c
vm_zeroidle.c Eliminate dead code, specifically, an unused sysctl: "vm.idlezero_maxrun". 2007-07-14 19:00:44 +00:00
vm.h Retire debug.mpsafevm. None of the architectures supported in CVS require 2006-07-21 23:22:49 +00:00
vnode_pager.c When we do open, we should lock the vnode exclusively. This fixes few races: 2007-07-26 16:58:09 +00:00
vnode_pager.h