diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-18 12:33:06 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-18 12:33:06 +0100 |
commit | 6bb992cb04926895be57dc97e7d569ea15a07db1 (patch) | |
tree | 12f90320f7aac28711d308c76db1e51f4d4aa58b /sysdep/unix/alloc.c | |
parent | 973aa37e1e28a9c508fe09c008196f64cd3966fd (diff) | |
parent | 7144c9ca46f092da33a4e051bbce8f973a3bd8c4 (diff) |
Merge branch 'master' of https://gitlab.nic.cz/labs/bird
Diffstat (limited to 'sysdep/unix/alloc.c')
-rw-r--r-- | sysdep/unix/alloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 0ca12ec3..d625cd38 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -19,6 +19,10 @@ #include <sys/mman.h> #endif +#ifdef CONFIG_DISABLE_THP +#include <sys/prctl.h> +#endif + long page_size = 0; #ifdef HAVE_MMAP @@ -222,6 +226,12 @@ global_free_pages_cleanup_event(void *data UNUSED) void resource_sys_init(void) { +#ifdef CONFIG_DISABLE_THP + /* Disable transparent huge pages, they do not work properly with madvice(MADV_DONTNEED) */ + if (prctl(PR_SET_THP_DISABLE, (unsigned long) 1, (unsigned long) 0, (unsigned long) 0, (unsigned long) 0) < 0) + die("prctl(PR_SET_THP_DISABLE) failed: %m"); +#endif + #ifdef HAVE_MMAP ASSERT_DIE(global_free_pages.cnt == 0); |