diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-24 09:45:40 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-24 09:45:40 +0100 |
commit | 02b2a4ecaaf850ce04b0cd2e74c1ff6fede3f181 (patch) | |
tree | 70e459c6543dc09059055a103d4f388e9b5b9c18 /sysdep/unix/alloc.c | |
parent | 3d96a16ae85db4329d2a24b7df9b3c18ae4e1045 (diff) | |
parent | 3186ffe79714a48542d5ad61a94c81216b522fd0 (diff) |
Merge commit '3186ffe79714a48542d5ad61a94c81216b522fd0' into thread-next
Diffstat (limited to 'sysdep/unix/alloc.c')
-rw-r--r-- | sysdep/unix/alloc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 04cf7498..6c68a865 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -22,6 +22,9 @@ #ifdef CONFIG_DISABLE_THP #include <sys/prctl.h> +#ifndef PR_SET_THP_DISABLE +#define PR_SET_THP_DISABLE 41 +#endif #endif long page_size = 0; @@ -78,7 +81,7 @@ alloc_sys_page(void) void *ptr = mmap(NULL, page_size * ALLOC_PAGES_AT_ONCE, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) - bug("mmap(%lu) failed: %m", page_size); + die("mmap(%ld) failed: %m", (s64) page_size); return ptr; } @@ -99,7 +102,7 @@ alloc_page(void) int err = posix_memalign(&ptr, page_size, page_size); if (err || !ptr) - bug("posix_memalign(%lu) failed", (long unsigned int) page_size); + die("posix_memalign(%ld) failed", (s64) page_size); return ptr; } @@ -298,7 +301,7 @@ 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"); + log(L_WARN "Cannot disable transparent huge pages: prctl(PR_SET_THP_DISABLE) failed: %m"); #endif #ifdef HAVE_MMAP |