Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 22:40:46 +0000 (UTC)
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357550 - head/sys/vm
Message-ID:  <202002042240.014MekRs068957@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rlibby
Date: Tue Feb  4 22:40:45 2020
New Revision: 357550
URL: https://svnweb.freebsd.org/changeset/base/357550

Log:
  uma: multipage chicken switch
  
  Add a switch to allow disabling multipage slabs, in order to facilitate
  measuring memory usage and performance effects.  The tunable
  vm.debug.uma_multipage_slabs defaults to 1 and can be set to 0 to
  disable.  The name may change soon.
  
  Reviewed by:	markj (previous version)
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D23487

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Tue Feb  4 22:40:34 2020	(r357549)
+++ head/sys/vm/uma_core.c	Tue Feb  4 22:40:45 2020	(r357550)
@@ -323,6 +323,9 @@ static int sysctl_handle_uma_zone_items(SYSCTL_HANDLER
 
 static uint64_t uma_zone_get_allocs(uma_zone_t zone);
 
+static SYSCTL_NODE(_vm, OID_AUTO, debug, CTLFLAG_RD, 0,
+    "Memory allocation debugging");
+
 #ifdef INVARIANTS
 static uint64_t uma_keg_get_allocs(uma_keg_t zone);
 static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
@@ -332,9 +335,6 @@ static bool uma_dbg_zskip(uma_zone_t zone, void *mem);
 static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);
 static void uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *item);
 
-static SYSCTL_NODE(_vm, OID_AUTO, debug, CTLFLAG_RD, 0,
-    "Memory allocation debugging");
-
 static u_int dbg_divisor = 1;
 SYSCTL_UINT(_vm_debug, OID_AUTO, divisor,
     CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &dbg_divisor, 0,
@@ -362,6 +362,12 @@ static int zone_warnings = 1;
 SYSCTL_INT(_vm, OID_AUTO, zone_warnings, CTLFLAG_RWTUN, &zone_warnings, 0,
     "Warn when UMA zones becomes full");
 
+static int multipage_slabs = 1;
+TUNABLE_INT("vm.debug.uma_multipage_slabs", &multipage_slabs);
+SYSCTL_INT(_vm_debug, OID_AUTO, uma_multipage_slabs,
+    CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &multipage_slabs, 0,
+    "UMA may choose larger slab sizes for better efficiency");
+
 /*
  * Select the slab zone for an offpage slab with the given maximum item count.
  */
@@ -1993,7 +1999,7 @@ keg_layout(uma_keg_t keg)
 				break;
 		}
 
-		if (kl.eff >= UMA_MIN_EFF ||
+		if (kl.eff >= UMA_MIN_EFF || !multipage_slabs ||
 		    slabsize >= SLAB_MAX_SETSIZE * rsize ||
 		    (keg->uk_flags & (UMA_ZONE_PCPU | UMA_ZONE_CONTIG)) != 0)
 			break;



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