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.
This commit is contained in:
David Goldblatt 2020-10-05 17:39:01 -07:00 committed by David Goldblatt
parent 21b70cb540
commit b971f7c4dd
2 changed files with 4 additions and 2 deletions

View File

@ -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, CONF_CHECK_MIN, CONF_CHECK_MAX,
true); true);
if (CONF_MATCH("slab_sizes")) { if (CONF_MATCH("slab_sizes")) {
if (CONF_MATCH_VALUE("default")) {
sc_data_init(sc_data);
CONF_CONTINUE;
}
bool err; bool err;
const char *slab_size_segment_cur = v; const char *slab_size_segment_cur = v;
size_t vlen_left = vlen; size_t vlen_left = vlen;

View File

@ -257,8 +257,6 @@ size_classes(
void void
sc_data_init(sc_data_t *sc_data) { 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, size_classes(sc_data, LG_SIZEOF_PTR, LG_QUANTUM, SC_LG_TINY_MIN,
SC_LG_MAX_LOOKUP, LG_PAGE, SC_LG_NGROUP); SC_LG_MAX_LOOKUP, LG_PAGE, SC_LG_NGROUP);