Bootstrapping: Parse MALLOC_CONF before using slab sizes.

I.e., parse before booting the bin module or sz module.  This lets us tweak size
class settings before committing to them by letting them leak into other
modules.

This commit does not actually do any tweaking of the size classes; it *just*
chanchanges bootstrapping order; this may help bisecting any bootstrapping
failures on poorly-tested architectures.
This commit is contained in:
David T. Goldblatt 2018-04-20 19:12:45 -07:00 committed by David Goldblatt
parent a7f68aed3e
commit 4610ffa942

View File

@ -1295,14 +1295,21 @@ static bool
malloc_init_hard_a0_locked() {
malloc_initializer = INITIALIZER;
/*
* Ordering here is somewhat tricky; we need sc_boot() first, since that
* determines what the size classes will be, and then
* malloc_conf_init(), since any slab size tweaking will need to be done
* before sz_boot and bin_boot, which assume that the values they read
* out of sc_data_global are final.
*/
sc_boot();
malloc_conf_init();
sz_boot(&sc_data_global);
bin_boot(&sc_data_global);
if (config_prof) {
prof_boot0();
}
malloc_conf_init();
if (opt_stats_print) {
/* Print statistics at exit. */
if (atexit(stats_print_atexit) != 0) {