freebsd-dev/sys/vm
Konstantin Belousov 76386c7ecd Rework the test which raises OOM condition. Right now, the code
checks for the swap space consumption plus checks that the amount of
the free pages exceeds some limit, in case pagedeamon did not coped
with the page shortage in one of the late passes.  This is wrong
because it does not account for the presence of the reclamaible pages
in the queues which are not selectable for reclaim immediately.  E.g.,
on the swap-less systems, large active queue easily triggered OOM.

Instead, only raise OOM when pagedaemon is unable to produce a free
page in several back-to-back passes.  Track the failed passes per
pagedaemon thread.

The number of passes to trigger OOM was selected empirically and
tested both on small (32M-64M i386 VM) and large (32G amd64)
configurations.  If the specifics of the load require tuning, sysctl
vm.pageout_oom_seq sets the number of back-to-back passes which must
fail before OOM is raised.  Each pass takes 1/2 of seconds.  Less the
value, more sensible the pagedaemon is to the page shortage.

In future, some heuristic to calculate the value of the tunable might
be designed based on the system configuration and load.  But before it
can be done, the i/o system must be fixed to reliably time-out
pagedaemon writes, even if waiting for the memory to proceed.  Then,
code can account for the in-flight page-outs and postpone OOM until
all of them finished, which should reduce the need in tuning.  Right
now, ignoring the in-flight writes and the counter allows to break
deadlocks due to write path doing sleepable memory allocations.

Reported by:	Dmitry Sivachenko, bde, many others
Tested by:	pho, bde, tuexen (arm)
Reviewed by:	alc
Discussed with:	bde, imp
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-11-16 06:26:26 +00:00
..
_vm_radix.h
default_pager.c
device_pager.c
memguard.c
memguard.h
phys_pager.c
pmap.h
redzone.c
redzone.h
sg_pager.c
swap_pager.c Mark swap_pager_putpages static at its definition. It was already 2015-10-05 21:29:17 +00:00
swap_pager.h
uma_core.c Exploit r288122 to address a cosmetic issue. Since the pages allocated 2015-09-26 17:45:10 +00:00
uma_dbg.c
uma_dbg.h
uma_int.h
uma.h
vm_domain.c
vm_domain.h
vm_extern.h
vm_fault.c
vm_glue.c Exploit r288122 to avoid pointlessly enqueueing a page that is about to be 2015-10-09 03:38:58 +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 Export various helper variables describing the layout and size of 2015-11-12 22:00:59 +00:00
vm_kern.h
vm_map.c Remove a check which caused spurious SIGSEGV on usermode access to the 2015-09-09 06:19:33 +00:00
vm_map.h
vm_meter.c Remove the v_cache_min and v_cache_max sysctls. They are unused and have 2015-09-11 03:00:20 +00:00
vm_mmap.c
vm_object.c As a step towards the elimination of PG_CACHED pages, rework the handling 2015-09-30 23:06:29 +00:00
vm_object.h As a step towards the elimination of PG_CACHED pages, rework the handling 2015-09-30 23:06:29 +00:00
vm_page.c Ensure that deactivated pages that are not expected to be reused are 2015-11-08 01:36:18 +00:00
vm_page.h Rework the test which raises OOM condition. Right now, the code 2015-11-16 06:26:26 +00:00
vm_pageout.c Rework the test which raises OOM condition. Right now, the code 2015-11-16 06:26:26 +00:00
vm_pageout.h Reduce the scope of a variable to the only file where it is used. 2015-10-03 19:27:52 +00:00
vm_pager.c
vm_pager.h
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
vm_phys.h
vm_radix.c
vm_radix.h
vm_reserv.c
vm_reserv.h
vm_unix.c
vm_zeroidle.c
vm.h
vnode_pager.c Reduce the amount of calls to VOP_BMAP() made from the local vnode 2015-10-24 21:59:22 +00:00
vnode_pager.h