reserve huge OS pages earlier on at process_init

This commit is contained in:
daan 2019-11-12 10:19:52 -08:00
parent af746ca4c1
commit 867d78f877

View File

@ -440,11 +440,6 @@ static void mi_process_load(void) {
if (msg != NULL && (mi_option_is_enabled(mi_option_verbose) || mi_option_is_enabled(mi_option_show_errors))) {
_mi_fputs(NULL,NULL,msg);
}
if (mi_option_is_enabled(mi_option_reserve_huge_os_pages)) {
size_t pages = mi_option_get(mi_option_reserve_huge_os_pages);
mi_reserve_huge_os_pages_interleave(pages, pages*500);
}
}
// Initialize the process; called by thread_init or the process loader
@ -471,6 +466,11 @@ void mi_process_init(void) mi_attr_noexcept {
#endif
mi_thread_init();
mi_stats_reset(); // only call stat reset *after* thread init (or the heap tld == NULL)
if (mi_option_is_enabled(mi_option_reserve_huge_os_pages)) {
size_t pages = mi_option_get(mi_option_reserve_huge_os_pages);
mi_reserve_huge_os_pages_interleave(pages, pages*500);
}
}
// Called when the process is done (through `at_exit`)