freebsd-src/sys/vm
Brian Feldman 4362fada8f Reimplement contigmalloc(9) with an algorithm which stands a greatly-
improved chance of working despite pressure from running programs.
Instead of trying to throw a bunch of pages out to swap and hope for
the best, only a range that can potentially fulfill contigmalloc(9)'s
request will have its contents paged out (potentially, not forcibly)
at a time.

The new contigmalloc operation still operates in three passes, but it
could potentially be tuned to more or less.  The first pass only looks
at pages in the cache and free pages, so they would be thrown out
without having to block.  If this is not enough, the subsequent passes
page out any unwired memory.  To combat memory pressure refragmenting
the section of memory being laundered, each page is removed from the
systems' free memory queue once it has been freed so that blocking
later doesn't cause the memory laundered so far to get reallocated.

The page-out operations are now blocking, as it would make little sense
to try to push out a page, then get its status immediately afterward
to remove it from the available free pages queue, if it's unlikely to
have been freed.  Another change is that if KVA allocation fails, the
allocated memory segment will be freed and not leaked.

There is a sysctl/tunable, defaulting to on, which causes the old
contigmalloc() algorithm to be used.  Nonetheless, I have been using
vm.old_contigmalloc=0 for over a month.  It is safe to switch at
run-time to see the difference it makes.

A new interface has been used which does not require mapping the
allocated pages into KVA: vm_page.h functions vm_page_alloc_contig()
and vm_page_release_contig().  These are what vm.old_contigmalloc=0
uses internally, so the sysctl/tunable does not affect their operation.

When using the contigmalloc(9) and contigfree(9) interfaces, memory
is now tracked with malloc(9) stats.  Several functions have been
exported from kern_malloc.c to allow other subsystems to use these
statistics, as well.  This invalidates the BUGS section of the
contigmalloc(9) manpage.
2004-07-19 06:21:27 +00:00
..
default_pager.c Access the swap_pagers' ->putpages() through swappagerops instead 2003-08-06 12:05:48 +00:00
device_pager.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
phys_pager.c Zero the physical page only if it is invalid and not prezeroed. 2004-04-25 07:58:59 +00:00
pmap.h - pmap_kenter_temporary() is unused by machine-independent code. Therefore, 2004-04-10 22:41:46 +00:00
swap_pager.c Properly brucify a string by outdenting it. 2004-07-06 02:27:30 +00:00
swap_pager.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
uma.h Fix a comment above uma_zsecond_create(), describing its arguments. 2004-06-01 01:36:26 +00:00
uma_core.c Introduce debug.nosleepwithlocks sysctl, 0 by default. If set to 1 2004-07-04 16:07:44 +00:00
uma_dbg.c Bring in mbuma to replace mballoc. 2004-05-31 21:46:06 +00:00
uma_dbg.h - Use my freebsd email alias in the copyright. 2002-09-19 06:05:32 +00:00
uma_int.h Bring in mbuma to replace mballoc. 2004-05-31 21:46:06 +00:00
vm.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_contig.c Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
vm_extern.h To date, unwiring a fictitious page has produced a panic. The reason 2004-05-22 04:53:51 +00:00
vm_fault.c To date, unwiring a fictitious page has produced a panic. The reason 2004-05-22 04:53:51 +00:00
vm_glue.c - Don't use a variable to point to the user area that we only use once. 2004-07-02 03:45:07 +00:00
vm_init.c The demise of vm_pager_map_page() in revision 1.93 of vm/vm_pager.c permits 2004-04-08 19:08:49 +00:00
vm_kern.c Bring in mbuma to replace mballoc. 2004-05-31 21:46:06 +00:00
vm_kern.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_map.c Push down the acquisition and release of the page queues lock into 2004-07-15 18:00:43 +00:00
vm_map.h Micro-optimize vmspace for 64-bit architectures: Colocate vm_refcnt and 2004-07-06 17:35:10 +00:00
vm_meter.c Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_mmap.c Deorbit COMPAT_SUNOS. 2004-06-11 11:16:26 +00:00
vm_object.c Initialize result->backing_object_offset before linking result onto the list of 2004-06-28 20:26:35 +00:00
vm_object.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_page.c Increase the scope of the page queues lock in vm_page_alloc() to cover 2004-07-10 22:12:49 +00:00
vm_page.h Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
vm_pageout.c Remove the GIANT_REQUIRED preceding pmap_remove() in 2004-07-18 04:38:11 +00:00
vm_pageout.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_pageq.c Remove references to L1 in the comments, according to Alan they are 2004-06-07 19:33:05 +00:00
vm_pager.c The demise of vm_pager_map_page() in revision 1.93 of vm/vm_pager.c permits 2004-04-08 19:08:49 +00:00
vm_pager.h The demise of vm_pager_map_page() in revision 1.93 of vm/vm_pager.c permits 2004-04-08 19:08:49 +00:00
vm_param.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
vm_unix.c Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00
vm_zeroidle.c Implement preemption of kernel threads natively in the scheduler rather 2004-07-02 20:21:44 +00:00
vnode_pager.c Make vm_page's PG_ZERO flag immutable between the time of the page's 2004-05-06 05:03:23 +00:00
vnode_pager.h Remove advertising clause from University of California Regent's license, 2004-04-06 20:15:37 +00:00