freebsd-dev/sys/vm
Alan Cox a8b0f1009d Replace vm_fault()'s heuristic for automatic cache behind with a heuristic
that performs the equivalent of an automatic madvise(..., MADV_DONTNEED).
The current heuristic, even with the improvements that I made a few years
ago, is a good example of making the wrong trade-off, or optimizing for
the infrequent case.  The infrequent case being reading a single file that
is much larger than memory using mmap(2).  And, in this case, the page
daemon isn't the bottleneck; it's the I/O.

In all other cases, the current heuristic has too many false positives,
i.e., it caches too many pages that are later reused.  To give one
example, thousands of pages are cached by the current heuristic during a
buildworld and all of them are reactivated before the buildworld
completes.  In particular, clang reads source files using mmap(2) and
there are some relatively large source files in our source tree, e.g.,
sqlite, that are read multiple times.  With the new heuristic, I see fewer
false positives and they have a much lower cost.

I actually tried something like this more than two years ago and it
didn't perform as well as the cache behind heuristic.  However, that was
before the changes to the page daemon in late summer of 2013 and the
existence of pmap_advise().  In particular, with the page daemon doing
its work more frequently and in smaller batches, it now completes its
work while the application accessing the file is blocked on I/O.
Whereas previously, the page daemon appeared to hog the CPU for so long
that it caused "hiccups" in the application's execution.

Finally, I'll add that the elimination of cache pages is a prerequisite
for NUMA support.

Reviewed by:	jeff, kib
Sponsored by:	EMC / Isilon Storage Division
2015-04-04 19:10:22 +00:00
..
_vm_radix.h On all the architectures, avoid to preallocate the physical memory 2013-08-09 11:28:55 +00:00
default_pager.c Fix mis-spelling of bits and types names in the 2014-11-04 19:56:04 +00:00
device_pager.c Initialize paddr to handle the case of zero size. 2014-03-12 16:38:55 +00:00
memguard.c Add comments about CTLFLAG_RDTUN vs. TUNABLE_INT_FETCH. 2015-03-26 05:20:18 +00:00
memguard.h Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
phys_pager.c The soft and hard busy mechanism rely on the vm object lock to work. 2013-08-09 11:11:11 +00:00
pmap.h Change pmap_enter(9) interface to take flags parameter and superpage 2014-08-08 17:12:03 +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 Different consumers of the struct vm_page abuse pageq member to keep 2013-08-10 17:36:42 +00:00
swap_pager.c Make swapper release orphaned (lost) GEOM provider. 2015-03-26 17:21:12 +00:00
swap_pager.h Do not map the swap i/o pbufs if the geom provider for the swap 2013-03-19 14:39:27 +00:00
uma_core.c Fix integer truncation bug in malloc(9) 2015-04-01 12:42:26 +00:00
uma_dbg.c - Add a per-zone lock for zones without kegs. 2013-06-20 19:08:12 +00:00
uma_dbg.h
uma_int.h Fix integer truncation bug in malloc(9) 2015-04-01 12:42:26 +00:00
uma.h Fix integer truncation bug in malloc(9) 2015-04-01 12:42:26 +00:00
vm_extern.h Handle wiring failures in vm_map_wire() with the new functions 2014-08-02 16:10:24 +00:00
vm_fault.c Replace vm_fault()'s heuristic for automatic cache behind with a heuristic 2015-04-04 19:10:22 +00:00
vm_glue.c Add kernel option KSTACK_USAGE_PROF to sample the stack depth on 2014-10-04 18:38:14 +00:00
vm_init.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
vm_kern.c Fix multiple incorrect SYSCTL arguments in the kernel: 2014-10-21 07:31:21 +00:00
vm_kern.h - Add a statically allocated memguard arena since it is needed very early 2013-08-13 22:40:43 +00:00
vm_map.c vmspace_release() may sleep if the last reference is being released, 2015-01-24 16:59:38 +00:00
vm_map.h Oops. vm_map_simplify_entry() is used by mac_proc_vm_revoke_recurse(), so 2014-09-08 02:25:01 +00:00
vm_meter.c Rename global cnt to vm_cnt to avoid shadowing. 2014-03-22 10:26:09 +00:00
vm_mmap.c Introduce vm_object_color() and use it in mmap(2) to set the color of 2015-03-21 17:56:55 +00:00
vm_object.c Correct a typo in vm_object_backing_scan() that originated in r254141. 2015-03-07 04:18:40 +00:00
vm_object.h Introduce vm_object_color() and use it in mmap(2) to set the color of 2015-03-21 17:56:55 +00:00
vm_page.c Add comments about CTLFLAG_RDTUN vs. TUNABLE_INT_FETCH. 2015-03-26 05:20:18 +00:00
vm_page.h Add flag VM_ALLOC_NOWAIT for vm_page_grab() that prevents sleeping and 2014-12-22 09:02:21 +00:00
vm_pageout.c - Eliminate pagequeue locking in the dirty code in vm_pageout_scan(). 2015-03-28 02:36:49 +00:00
vm_pageout.h
vm_pager.c o Enhance vm_pager_free_nonreq() function: 2015-03-17 19:19:19 +00:00
vm_pager.h o Enhance vm_pager_free_nonreq() function: 2015-03-17 19:19:19 +00:00
vm_param.h Rename global cnt to vm_cnt to avoid shadowing. 2014-03-22 10:26:09 +00:00
vm_phys.c Revert r279932; this is going to be fixed in the sbuf code instead. 2015-03-14 13:00:37 +00:00
vm_phys.h The physical memory allocator supports the use of distinct free lists for 2014-12-31 00:54:38 +00:00
vm_radix.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
vm_radix.h Eliminate a redundant parameter to vm_radix_replace(). 2013-12-08 20:07:02 +00:00
vm_reserv.c Revert r279932; this is going to be fixed in the sbuf code instead. 2015-03-14 13:00:37 +00:00
vm_reserv.h Refactor vm_page_alloc()'s interactions with vm_reserv_alloc_page() and 2013-05-12 16:50:18 +00:00
vm_unix.c Remove ia64. 2014-07-07 00:27:09 +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 rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST 2013-07-24 09:45:31 +00:00
vnode_pager.c Catch up on r271387 and remove unused parameter from 2015-03-30 22:49:26 +00:00
vnode_pager.h Merge from projects/sendfile: 2014-11-23 12:01:52 +00:00