aboutsummaryrefslogtreecommitdiff
path: root/contrib/jemalloc/src/pages.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/jemalloc/src/pages.c')
-rw-r--r--contrib/jemalloc/src/pages.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/jemalloc/src/pages.c b/contrib/jemalloc/src/pages.c
index 13de27a0087d..6405bb528984 100644
--- a/contrib/jemalloc/src/pages.c
+++ b/contrib/jemalloc/src/pages.c
@@ -11,7 +11,9 @@
#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
#include <sys/sysctl.h>
#ifdef __FreeBSD__
+#include <sys/auxv.h>
#include <vm/vm_param.h>
+#include <vm/vm.h>
#endif
#endif
@@ -440,6 +442,13 @@ os_overcommits_sysctl(void) {
int vm_overcommit;
size_t sz;
+#ifdef ELF_BSDF_VMNOOVERCOMMIT
+ int bsdflags;
+
+ if (_elf_aux_info(AT_BSDFLAGS, &bsdflags, sizeof(bsdflags)) == 0)
+ return ((bsdflags & ELF_BSDF_VMNOOVERCOMMIT) == 0);
+#endif
+
sz = sizeof(vm_overcommit);
#if defined(__FreeBSD__) && defined(VM_OVERCOMMIT)
int mib[2];
@@ -455,7 +464,12 @@ os_overcommits_sysctl(void) {
}
#endif
- return ((vm_overcommit & 0x3) == 0);
+#ifndef SWAP_RESERVE_FORCE_ON
+#define SWAP_RESERVE_FORCE_ON (1 << 0)
+#define SWAP_RESERVE_RLIMIT_ON (1 << 1)
+#endif
+ return ((vm_overcommit & (SWAP_RESERVE_FORCE_ON |
+ SWAP_RESERVE_RLIMIT_ON)) == 0);
}
#endif