diff options
| author | christos <christos@NetBSD.org> | 2019-03-16 22:14:08 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2019-03-16 22:14:08 +0000 |
| commit | ff4b692e765cead9c5edef1c9c95cf38d7d71e8a (patch) | |
| tree | de868ead026ceb2276ecb5cfdbfd1f4d1c67ef5f /external/bsd/jemalloc | |
| parent | f17073ec02f508105e2abdca74c8b7ecc54e1c95 (diff) | |
we have MAP_ALIGNED, so use it (although it does not do anything by default)
Diffstat (limited to 'external/bsd/jemalloc')
| -rw-r--r-- | external/bsd/jemalloc/dist/src/pages.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/external/bsd/jemalloc/dist/src/pages.c b/external/bsd/jemalloc/dist/src/pages.c index 26002692d60..9e61a53bc86 100644 --- a/external/bsd/jemalloc/dist/src/pages.c +++ b/external/bsd/jemalloc/dist/src/pages.c @@ -14,6 +14,9 @@ #include <vm/vm_param.h> #endif #endif +#ifdef MAP_ALIGNED +#include <sys/bitops.h> /* NetBSD */ +#endif /******************************************************************************/ /* Data. */ @@ -74,9 +77,15 @@ os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) { * of existing mappings, and we only want to create new mappings. */ { + int flags = mmap_flags; +#ifdef MAP_ALIGNED + int a = ilog2(alignment); + if (a > LG_PAGE && a < ilog2(sizeof(void *))) + flags |= MAP_ALIGNED(a); +#endif int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT; - ret = mmap(addr, size, prot, mmap_flags, -1, 0); + ret = mmap(addr, size, prot, flags, -1, 0); } assert(ret != NULL); |
