mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
disable transparent huge pages for a process too if the allow_large_os_pages option is set to false
This commit is contained in:
parent
e46c1145a5
commit
79ab7c63d7
1 changed files with 14 additions and 7 deletions
|
@ -148,7 +148,13 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
|
|||
config->has_virtual_reserve = true; // todo: check if this true for NetBSD? (for anonymous mmap with PROT_NONE)
|
||||
|
||||
// disable transparent huge pages for this process?
|
||||
#if defined(MI_NO_THP) && (defined(__linux__) || defined(__ANDROID__))
|
||||
#if (defined(__linux__) || defined(__ANDROID__)) && defined(PR_GET_THP_DISABLE)
|
||||
#if defined(MI_NO_THP)
|
||||
if (true)
|
||||
#else
|
||||
if (!mi_option_is_enabled(mi_option_allow_large_os_pages)) // disable THP also if large OS pages are not allowed in the options
|
||||
#endif
|
||||
{
|
||||
int val = 0;
|
||||
if (prctl(PR_GET_THP_DISABLE, &val, 0, 0, 0) != 0) {
|
||||
// Most likely since distros often come with always/madvise settings.
|
||||
|
@ -156,6 +162,7 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
|
|||
// Disabling only for mimalloc process rather than touching system wide settings
|
||||
(void)prctl(PR_SET_THP_DISABLE, &val, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue