Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2016 11:35:07 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r302649 - vendor-sys/illumos/dist/uts/common/fs/zfs
Message-ID:  <201607121135.u6CBZ70S096773@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Jul 12 11:35:07 2016
New Revision: 302649
URL: https://svnweb.freebsd.org/changeset/base/302649

Log:
  7016 arc_available_memory is not 32-bit safe
  
  illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190
  https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190
  
  https://www.illumos.org/issues/7016
    upstream DLPX-39446 arc_available_memory is not 32-bit safe
    https://github.com/delphix/delphix-os/commit/
    6b353ea3b8a1610be22e71e657d051743c64190b
    related to this upstream:
    DLPX-38547 delphix engine hang
    https://github.com/delphix/delphix-os/commit/
    3183a567b3e8c62a74a65885ca60c86f3d693783
    DLPX-38547 delphix engine hang (fix static global)
    https://github.com/delphix/delphix-os/commit/
    22ac551d8ef085ad66cc8f65e51ac372b12993b9
    DLPX-38882 system hung waiting on free segment
    https://github.com/delphix/delphix-os/commit/
    cdd6beef7548cd3b12f0fc0328eeb3af540079c2
  
  Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: Paul Dagnelie <pcd@delphix.com>
  Reviewed by: George Wilson <george.wilson@delphix.com>
  Approved by: Gordon Ross <gordon.ross@nexenta.com>
  Author: Prakash Surya <prakash.surya@delphix.com>

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Jul 12 11:34:05 2016	(r302648)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Jul 12 11:35:07 2016	(r302649)
@@ -216,6 +216,11 @@ static int arc_dead;
 static boolean_t arc_warm;
 
 /*
+ * log2 fraction of the zio arena to keep free.
+ */
+int arc_zio_arena_free_shift = 2;
+
+/*
  * These tunables are for performance analysis.
  */
 uint64_t zfs_arc_max;
@@ -3235,7 +3240,7 @@ arc_available_memory(void)
 	 * heap is allocated.  (Or, in the calculation, if less than 1/4th is
 	 * free)
 	 */
-	n = vmem_size(heap_arena, VMEM_FREE) -
+	n = (int64_t)vmem_size(heap_arena, VMEM_FREE) -
 	    (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2);
 	if (n < lowest) {
 		lowest = n;
@@ -3246,15 +3251,16 @@ arc_available_memory(void)
 	/*
 	 * If zio data pages are being allocated out of a separate heap segment,
 	 * then enforce that the size of available vmem for this arena remains
-	 * above about 1/16th free.
+	 * above about 1/4th (1/(2^arc_zio_arena_free_shift)) free.
 	 *
-	 * Note: The 1/16th arena free requirement was put in place
-	 * to aggressively evict memory from the arc in order to avoid
-	 * memory fragmentation issues.
+	 * Note that reducing the arc_zio_arena_free_shift keeps more virtual
+	 * memory (in the zio_arena) free, which can avoid memory
+	 * fragmentation issues.
 	 */
 	if (zio_arena != NULL) {
-		n = vmem_size(zio_arena, VMEM_FREE) -
-		    (vmem_size(zio_arena, VMEM_ALLOC) >> 4);
+		n = (int64_t)vmem_size(zio_arena, VMEM_FREE) -
+		    (vmem_size(zio_arena, VMEM_ALLOC) >>
+		    arc_zio_arena_free_shift);
 		if (n < lowest) {
 			lowest = n;
 			r = FMR_ZIO_ARENA;



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