freebsd-dev/sys/vm
Jonathan T. Looney 54503a13d8 Add a safety net to reclaim mbufs when one of the mbuf zones become
exhausted.

It is possible for a bug in the code (or, theoretically, even unusual
network conditions) to exhaust all possible mbufs or mbuf clusters.
When this occurs, things can grind to a halt fairly quickly. However,
we currently do not call mb_reclaim() unless the entire system is
experiencing a low-memory condition.

While it is best to try to prevent exhaustion of one of the mbuf zones,
it would also be useful to have a mechanism to attempt to recover from
these situations by freeing "expendable" mbufs.

This patch makes two changes:

a) The patch adds a generic API to the UMA zone allocator to set a
function that should be called when an allocation fails because the
zone limit has been reached. Because of the way this function can be
called, it really should do minimal work.

b) The patch uses this API to try to free mbufs when an allocation
fails from one of the mbuf zones because the zone limit has been
reached. The function schedules a callout to run mb_reclaim().

Differential Revision:	https://reviews.freebsd.org/D3864
Reviewed by:	gnn
Comments by:	rrs, glebius
MFC after:	2 weeks
Sponsored by:	Juniper Networks
2015-12-20 02:05:33 +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 vm_page_replace: add wrapper to KASSERT about old page 2015-12-17 17:48:57 +00:00
memguard.c Add comments about CTLFLAG_RDTUN vs. TUNABLE_INT_FETCH. 2015-03-26 05:20:18 +00:00
memguard.h
phys_pager.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +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 vm_page_replace: add wrapper to KASSERT about old page 2015-12-17 17:48:57 +00:00
swap_pager.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
swap_pager.h
uma_core.c Add a safety net to reclaim mbufs when one of the mbuf zones become 2015-12-20 02:05:33 +00:00
uma_dbg.c If INVARIANTS is specified, add ctor/dtor to junk memory if they are 2015-06-25 20:44:46 +00:00
uma_dbg.h
uma_int.h Add a safety net to reclaim mbufs when one of the mbuf zones become 2015-12-20 02:05:33 +00:00
uma.h Add a safety net to reclaim mbufs when one of the mbuf zones become 2015-12-20 02:05:33 +00:00
vm_domain.c Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +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 Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
vm_fault.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
vm_glue.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +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 Remove a check which caused spurious SIGSEGV on usermode access to the 2015-09-09 06:19:33 +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 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 Add a local variable initialization needed in the OBJT_DEFAULT case. 2015-07-05 22:26:19 +00:00
vm_object.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
vm_object.h A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +00:00
vm_page.c Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_page.h Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_pageout.c Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_pageout.h Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_pager.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +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 Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +00:00
vm_phys.h Introduce a new mechanism for relocating virtual pages to a new physical 2015-12-19 18:42:50 +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
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
vnode_pager.c A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). 2015-12-16 21:30:45 +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