From b1a90834bb25e04d883eb4ead99ca41d705e277f Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 21 Aug 2018 16:37:37 +0000 Subject: [PATCH] Set arc_kmem_cache_reap_retry_ms to 0 and make it configurable. r329759 introduced this parameter, which controls the rate at which ZFS UMA zones are drained when the ARC reclaim thread is shrinking the ARC. The reclamation target is derived from the global free page count, and arc_shrink() only frees buffers back to UMA, so the free page count is not updated until the zones are drained. Thus, back-to-back calls to arc_shrink() within the arc_kmem_cache_reap_retry_ms interval do not provide immediate feedback to the arc_reclaim control loop, so we may free more of the ARC than needed to address a transient page shortage. As we do not implement the asynchronous zone draining added in r329759, disable the retry interval, restoring pre-r329759 behaviour. That is, we will drain the ZFS UMA zones before each attempt to shrink the ARC. Reviewed by: mav MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index ca4331bccb7..b825a4c92e9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -320,7 +320,7 @@ int zfs_arc_evict_batch_limit = 10; static int arc_grow_retry = 60; /* number of milliseconds before attempting a kmem-cache-reap */ -static int arc_kmem_cache_reap_retry_ms = 1000; +static int arc_kmem_cache_reap_retry_ms = 0; /* shift of arc_c for calculating overflow limit in arc_get_data_impl */ int zfs_arc_overflow_shift = 8; @@ -435,7 +435,11 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_grow_retry, CTLFLAG_RW, &arc_grow_retry, 0, "Wait in seconds before considering growing ARC"); SYSCTL_INT(_vfs_zfs, OID_AUTO, compressed_arc_enabled, CTLFLAG_RDTUN, - &zfs_compressed_arc_enabled, 0, "Enable compressed ARC"); + &zfs_compressed_arc_enabled, 0, + "Enable compressed ARC"); +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_kmem_cache_reap_retry_ms, CTLFLAG_RWTUN, + &arc_kmem_cache_reap_retry_ms, 0, + "Interval between ARC kmem_cache reapings"); /* * We don't have a tunable for arc_free_target due to the dependency on