Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Nov 2018 01:58:37 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340311 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201811100158.wAA1wbY7064910@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Nov 10 01:58:37 2018
New Revision: 340311
URL: https://svnweb.freebsd.org/changeset/base/340311

Log:
  Do not ignore arc_adjust() return value.
  
  This covers scenario when ARC may not shrink as fast as it could:
  1. arc_size < arc_c and arc_adjust() does not evict anything, returning
     zero to arc_reclaim_thread();
  2. arc_available_memory() reports memory pressure, which can not be
     satisfied by arc_kmem_reap_now();
  3. arc_shrink() reduces arc_c and calls arc_adjust(), return of which is
     ignored;
  4. even if the last arc_adjust() could not satisfy arc_size < arc_c,
     arc_reclaim_thread() will still go to sleep, since the first one
     returned zero.
  
  Reviewed by:	allanjude, markj, sef
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.
  Differential Revision:	https://reviews.freebsd.org/D17927

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Fri Nov  9 22:18:43 2018	(r340310)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Sat Nov 10 01:58:37 2018	(r340311)
@@ -4565,7 +4565,7 @@ arc_flush(spa_t *spa, boolean_t retry)
 	(void) arc_flush_state(arc_mfu_ghost, guid, ARC_BUFC_METADATA, retry);
 }
 
-void
+uint64_t
 arc_shrink(int64_t to_free)
 {
 	uint64_t asize = aggsum_value(&arc_size);
@@ -4593,8 +4593,9 @@ arc_shrink(int64_t to_free)
 	if (asize > arc_c) {
 		DTRACE_PROBE2(arc__shrink_adjust, uint64_t, asize,
 			uint64_t, arc_c);
-		(void) arc_adjust();
+		return (arc_adjust());
 	}
+	return (0);
 }
 
 typedef enum free_memory_reason_t {
@@ -4917,7 +4918,7 @@ arc_reclaim_thread(void *unused __unused)
 				to_free = MAX(to_free, ptob(needfree));
 #endif
 #endif
-				arc_shrink(to_free);
+				evicted += arc_shrink(to_free);
 			}
 		} else if (free_memory < arc_c >> arc_no_grow_shift) {
 			arc_no_grow = B_TRUE;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811100158.wAA1wbY7064910>