Changeset View
Changeset View
Standalone View
Standalone View
contrib/jemalloc/src/pages.c
#define JEMALLOC_PAGES_C_ | #define JEMALLOC_PAGES_C_ | ||||
#include "jemalloc/internal/jemalloc_preamble.h" | #include "jemalloc/internal/jemalloc_preamble.h" | ||||
#include "jemalloc/internal/pages.h" | #include "jemalloc/internal/pages.h" | ||||
#include "jemalloc/internal/jemalloc_internal_includes.h" | #include "jemalloc/internal/jemalloc_internal_includes.h" | ||||
#include "jemalloc/internal/assert.h" | #include "jemalloc/internal/assert.h" | ||||
#include "jemalloc/internal/malloc_io.h" | #include "jemalloc/internal/malloc_io.h" | ||||
#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT | #ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#ifdef __FreeBSD__ | #ifdef __FreeBSD__ | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <sys/auxv.h> | |||||
#endif | #endif | ||||
#endif | #endif | ||||
/******************************************************************************/ | /******************************************************************************/ | ||||
/* Data. */ | /* Data. */ | ||||
/* Actual operating system page size, detected during bootstrap, <= PAGE. */ | /* Actual operating system page size, detected during bootstrap, <= PAGE. */ | ||||
static size_t os_page; | static size_t os_page; | ||||
▲ Show 20 Lines • Show All 409 Lines • ▼ Show 20 Lines | #else | ||||
} | } | ||||
return (size_t)result; | return (size_t)result; | ||||
#endif | #endif | ||||
} | } | ||||
#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT | #ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT | ||||
static bool | static bool | ||||
os_overcommits_sysctl(void) { | os_overcommits_sysctl(void) { | ||||
int vm_overcommit; | int vm_overcommit, bsdflags; | ||||
imp: Does this need #ifdef __FreeBSD__ && mumble to be acceptable upstream?
This comment applies… | |||||
Done Inline ActionsIt is already under some kind of #ifdef that implies BSD at least, and perhaps FreeBSD specifically. But I added one more #ifdef to hide ELF_BSDF_VMNOOVERCOMMIT. kib: It is already under some kind of #ifdef that implies BSD at least, and perhaps FreeBSD… | |||||
Done Inline Actionsbsdflags might trigger some -Wunused warning if ELF_BSDF_VMNOOVERCOMMIT is not defined. markj: `bsdflags` might trigger some -Wunused warning if ELF_BSDF_VMNOOVERCOMMIT is not defined. | |||||
size_t sz; | size_t sz; | ||||
if (_elf_aux_info(AT_BSDFLAGS, &bsdflags, sizeof(bsdflags)) == 0) | |||||
return ((bsdflags & ELF_BSDF_VMNOOVERCOMMIT) == 0); | |||||
sz = sizeof(vm_overcommit); | sz = sizeof(vm_overcommit); | ||||
#if defined(__FreeBSD__) && defined(VM_OVERCOMMIT) | #if defined(__FreeBSD__) && defined(VM_OVERCOMMIT) | ||||
int mib[2]; | int mib[2]; | ||||
mib[0] = CTL_VM; | mib[0] = CTL_VM; | ||||
mib[1] = VM_OVERCOMMIT; | mib[1] = VM_OVERCOMMIT; | ||||
if (sysctl(mib, 2, &vm_overcommit, &sz, NULL, 0) != 0) { | if (sysctl(mib, 2, &vm_overcommit, &sz, NULL, 0) != 0) { | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |
Does this need #ifdef FreeBSD && mumble to be acceptable upstream?
This comment applies generally through this file.