Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2017 11:23:17 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318925 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201705261123.v4QBNHWR075650@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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