Author: avg
Date: Fri May 26 11:23:16 2017
New Revision: 318925
URL: https://svnweb.freebsd.org/changeset/base/318925

Log:
  MFV r316929: 6914 kernel virtual memory fragmentation leads to hang
  
  illumos/illumos-gate@af868f46a5b794687741d5424de9e3a2d684a84a
  
https://github.com/illumos/illumos-gate/commit/af868f46a5b794687741d5424de9e3a2d684a84a
  
  https://www.illumos.org/issues/6914
  
  FreeBSD note: only a ZFS part of the change is merged, changes to the VM
  subsystem are not ported (obviously).  Also, now that FreeBSD has
  vmem(9) we don't have to ifdef-out the code that uses it.
  
  MFC after:    2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Fri May 26 
11:05:56 2017        (r318924)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Fri May 26 
11:23:16 2017        (r318925)
@@ -6339,19 +6339,6 @@ arc_init(void)
        /* Convert seconds to clock ticks */
        arc_min_prefetch_lifespan = 1 * hz;
 
-       /* Start out with 1/8 of all memory */
-       arc_c = allmem / 8;
-
-#ifdef illumos
-#ifdef _KERNEL
-       /*
-        * On architectures where the physical memory can be larger
-        * than the addressable space (intel in 32-bit mode), we may
-        * need to limit the cache to 1/8 of VM size.
-        */
-       arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8);
-#endif
-#endif /* illumos */
        /* set min cache to 1/32 of all memory, or arc_abs_min, whichever is 
more */
        arc_c_min = MAX(allmem / 32, arc_abs_min);
        /* set max to 5/8 of all memory, or all but 1GB, whichever is more */
@@ -6391,6 +6378,15 @@ arc_init(void)
        /* limit meta-data to 1/4 of the arc capacity */
        arc_meta_limit = arc_c_max / 4;
 
+#ifdef _KERNEL
+       /*
+        * Metadata is stored in the kernel's heap.  Don't let us
+        * use more than half the heap for the ARC.
+        */
+       arc_meta_limit = MIN(arc_meta_limit,
+           vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 2);
+#endif
+
        /* Allow the tunable to override if it is reasonable */
        if (zfs_arc_meta_limit > 0 && zfs_arc_meta_limit <= arc_c_max)
                arc_meta_limit = zfs_arc_meta_limit;
_______________________________________________
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