Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2017 12:48:36 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325851 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201711151248.vAFCmaRJ053114@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Nov 15 12:48:36 2017
New Revision: 325851
URL: https://svnweb.freebsd.org/changeset/base/325851

Log:
  remove the poor emulation of the IllumOS needfree global variable to prevent
  the ARC reclaim thread running longer than needed.
  
  Update the arc::needfree dtrace probe triggered in arc_lowmem() to also report
  the value we may want to free.
  
  Submitted by:	Nikita Kozlov <nikita.kozlov at blade-group.com>
  Reviewed by:	avg
  Approved by:	avg
  MFC after:	3 weeks
  Sponsored by:	blade
  Differential Revision:	https://reviews.freebsd.org/D12163

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	Wed Nov 15 12:27:02 2017	(r325850)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Wed Nov 15 12:48:36 2017	(r325851)
@@ -4199,8 +4199,6 @@ arc_shrink(int64_t to_free)
 	}
 }
 
-static long needfree = 0;
-
 typedef enum free_memory_reason_t {
 	FMR_UNKNOWN,
 	FMR_NEEDFREE,
@@ -4238,14 +4236,6 @@ arc_available_memory(void)
 	free_memory_reason_t r = FMR_UNKNOWN;
 
 #ifdef _KERNEL
-	if (needfree > 0) {
-		n = PAGESIZE * (-needfree);
-		if (n < lowest) {
-			lowest = n;
-			r = FMR_NEEDFREE;
-		}
-	}
-
 	/*
 	 * Cooperate with pagedaemon when it's time for it to scan
 	 * and reclaim some pages.
@@ -4510,9 +4500,6 @@ arc_reclaim_thread(void *dummy __unused)
 			int64_t to_free =
 			    (arc_c >> arc_shrink_shift) - free_memory;
 			if (to_free > 0) {
-#ifdef _KERNEL
-				to_free = MAX(to_free, ptob(needfree));
-#endif
 				arc_shrink(to_free);
 			}
 		} else if (free_memory < arc_c >> arc_no_grow_shift) {
@@ -4533,9 +4520,6 @@ arc_reclaim_thread(void *dummy __unused)
 		 * infinite loop.
 		 */
 		if (arc_size <= arc_c || evicted == 0) {
-#ifdef _KERNEL
-			needfree = 0;
-#endif
 			/*
 			 * We're either no longer overflowing, or we
 			 * can't evict anything more, so we should wake
@@ -6310,9 +6294,7 @@ arc_lowmem(void *arg __unused, int howto __unused)
 {
 
 	mutex_enter(&arc_reclaim_lock);
-	/* XXX: Memory deficit should be passed as argument. */
-	needfree = btoc(arc_c >> arc_shrink_shift);
-	DTRACE_PROBE(arc__needfree);
+	DTRACE_PROBE1(arc__needfree, int64_t, ((int64_t)freemem - zfs_arc_free_target) * PAGESIZE);
 	cv_signal(&arc_reclaim_thread_cv);
 
 	/*



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