Author: avg
Date: Tue Feb 27 14:32:33 2018
New Revision: 330061
URL: https://svnweb.freebsd.org/changeset/base/330061

Log:
  MFC r328776: ZFS ARC: restore illumos uses of 'needfree' that were removed in 
r325851

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c      Tue Feb 
27 14:29:20 2018        (r330060)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c      Tue Feb 
27 14:32:33 2018        (r330061)
@@ -4237,6 +4237,7 @@ arc_available_memory(void)
        free_memory_reason_t r = FMR_UNKNOWN;
 
 #ifdef _KERNEL
+#ifdef __FreeBSD__
        /*
         * Cooperate with pagedaemon when it's time for it to scan
         * and reclaim some pages.
@@ -4247,7 +4248,15 @@ arc_available_memory(void)
                r = FMR_LOTSFREE;
        }
 
-#ifdef illumos
+#else
+       if (needfree > 0) {
+               n = PAGESIZE * (-needfree);
+               if (n < lowest) {
+                       lowest = n;
+                       r = FMR_NEEDFREE;
+               }
+       }
+
        /*
         * check that we're out of range of the pageout scanner.  It starts to
         * schedule paging if freemem is less than lotsfree and needfree.
@@ -4290,7 +4299,7 @@ arc_available_memory(void)
                r = FMR_PAGES_PP_MAXIMUM;
        }
 
-#endif /* illumos */
+#endif /* __FreeBSD__ */
 #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
        /*
         * If we're on an i386 platform, it's possible that we'll exhaust the
@@ -4501,6 +4510,11 @@ arc_reclaim_thread(void *dummy __unused)
                        int64_t to_free =
                            (arc_c >> arc_shrink_shift) - free_memory;
                        if (to_free > 0) {
+#ifdef _KERNEL
+#ifdef illumos
+                               to_free = MAX(to_free, ptob(needfree));
+#endif
+#endif
                                arc_shrink(to_free);
                        }
                } else if (free_memory < arc_c >> arc_no_grow_shift) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to