jemalloc: use auxv ELF_BSDF_VMNOOVERCOMMIT instead of sysctl("vm.overcommit")

Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
This commit is contained in:
Konstantin Belousov 2022-09-12 22:44:37 +03:00
parent 62b4fb22df
commit 0ae364adcd

View file

@ -11,6 +11,7 @@
#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
@ -441,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];