mirror_zfs/module
Alexander Motin 17ca30185a
Set initial arc_c to arc_c_min instead of arc_c_max
For at least 15 years since OpenSolaris arc_c was set by default to
arc_c_max, later decreased under memory pressure.  I've noticed that
if arc_c was set high enough to cause memory pressure as considered
by ZFS, setting of arc_no_grow to TRUE in arc_reap_cb_check() makes
no effect until both arc_kmem_reap_soon() and delay(reap_retry_ms)
return.  All that time ZFS can continue increasing its effective ARC
size, causing more memory pressure, potentially up to the point when
OS low memory handler activates and reduces arc_c, requesting fast
reclamation of just allocated memory.

The problem seems to be more serious on FreeBSD and I guess Linux,
since neither of them implement/use asynchronous kmem reclamation,
so arc_kmem_reap_soon() can take more time.  On older FreeBSD 11 not
supporting multiple memory domains system with lots of RAM can get
completely unresponsive for minutes due to heavy lock congestion
between ARC reclamation and page daemon kmem reclamation threads.
With this change to more conservative arc_c value ARC stops growing
just it time and does not need later reclamation.

Also while there, since now growing arc_c is a more often situation,
use aggsum_upper_bound() instead of aggsum_compare() in arc_adapt()
to reduce lock congestion.  It is also getting in sync with code in
arc_get_data_impl().

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Allan Jude <allanjude@freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #10437
2020-06-17 14:27:04 -07:00
..
avl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
icp Add convenience wrappers for common uio usage 2020-06-14 10:09:55 -07:00
lua Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
nvpair Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
os FreeBSD: Kernel module should depend on xdr not krpc after 1300092 2020-06-16 11:47:04 -07:00
spl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
unicode Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
zcommon Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
zfs Set initial arc_c to arc_c_min instead of arc_c_max 2020-06-17 14:27:04 -07:00
.gitignore Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Kbuild.in Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Makefile.bsd Combine OS-independent ABD Code into Common Source File 2020-05-10 12:23:52 -07:00
Makefile.in Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00