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
This commit is contained in:
Ryan Libby 2020-02-04 22:40:45 +00:00
parent 27ca37acb7
commit 33e5a1ea3b

View File

@ -323,6 +323,9 @@ static int sysctl_handle_uma_zone_items(SYSCTL_HANDLER_ARGS);
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;