From b971f7c4dda04ba26f9fb52709c7153cef27021c Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Mon, 5 Oct 2020 17:39:01 -0700 Subject: [PATCH] Add "default" option to slab sizes. This comes in handy when overriding earlier settings to test alternate ones. We don't really include tests for this, but I claim that's OK here: - It's fairly straightforward - It's fairly hard to test well - This entire code path is undocumented and mostly for our internal experimentation in the first place. - I tested manually. --- src/jemalloc.c | 4 ++++ src/sc.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jemalloc.c b/src/jemalloc.c index 0ca400e3..b21b2d9d 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1458,6 +1458,10 @@ malloc_conf_init_helper(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS], CONF_CHECK_MIN, CONF_CHECK_MAX, true); if (CONF_MATCH("slab_sizes")) { + if (CONF_MATCH_VALUE("default")) { + sc_data_init(sc_data); + CONF_CONTINUE; + } bool err; const char *slab_size_segment_cur = v; size_t vlen_left = vlen; diff --git a/src/sc.c b/src/sc.c index 1474eacc..37683ff4 100644 --- a/src/sc.c +++ b/src/sc.c @@ -257,8 +257,6 @@ size_classes( void sc_data_init(sc_data_t *sc_data) { - assert(!sc_data->initialized); - size_classes(sc_data, LG_SIZEOF_PTR, LG_QUANTUM, SC_LG_TINY_MIN, SC_LG_MAX_LOOKUP, LG_PAGE, SC_LG_NGROUP);