Author: avg
Date: Fri Feb  2 12:57:33 2018
New Revision: 328776
URL: https://svnweb.freebsd.org/changeset/base/328776

Log:
  ZFS ARC: restore illumos uses of 'needfree' that were removed in r325851
  
  This is purely a cosmetic change to have a more complete copy of
  ifdef-ed out illumos code.
  
  MFC after:    1 week

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 Feb  2 
12:52:42 2018        (r328775)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Fri Feb  2 
12:57:33 2018        (r328776)
@@ -4236,6 +4236,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.
@@ -4246,7 +4247,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.
@@ -4289,7 +4298,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
@@ -4482,6 +4491,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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to