summaryrefslogtreecommitdiff
path: root/external/bsd/jemalloc
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2019-04-24 14:34:21 +0000
committerchristos <christos@NetBSD.org>2019-04-24 14:34:21 +0000
commit3405cf2cd742ecfc60456d4d896a4e27a2ded313 (patch)
tree8697cf80da55d1623e3bc384b2a038e112e788a6 /external/bsd/jemalloc
parent86fef5cca0efe957989352a636f1624b0b380214 (diff)
Allow os_page sizes greater than the built-in page size. This can happen
for example for COMPAT_NETBSD32 sparc binaries (4K page size because of MIN_PAGE_SIZE), running on sparc64 (8K pages).
Diffstat (limited to 'external/bsd/jemalloc')
-rw-r--r--external/bsd/jemalloc/dist/src/pages.c12
-rw-r--r--external/bsd/jemalloc/dist/src/tsd.c3
2 files changed, 9 insertions, 6 deletions
diff --git a/external/bsd/jemalloc/dist/src/pages.c b/external/bsd/jemalloc/dist/src/pages.c
index 9e61a53bc86..ebd34b29711 100644
--- a/external/bsd/jemalloc/dist/src/pages.c
+++ b/external/bsd/jemalloc/dist/src/pages.c
@@ -55,8 +55,8 @@ static void os_pages_unmap(void *addr, size_t size);
static void *
os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
- assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
- assert(ALIGNMENT_CEILING(size, os_page) == size);
+ assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+ assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
assert(size != 0);
if (os_overcommits) {
@@ -135,8 +135,8 @@ os_pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size,
static void
os_pages_unmap(void *addr, size_t size) {
- assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
- assert(ALIGNMENT_CEILING(size, os_page) == size);
+ assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+ assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
#ifdef _WIN32
if (VirtualFree(addr, 0, MEM_RELEASE) == 0)
@@ -187,7 +187,7 @@ pages_map_slow(size_t size, size_t alignment, bool *commit) {
void *
pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
assert(alignment >= PAGE);
- assert(ALIGNMENT_ADDR2BASE(addr, alignment) == addr);
+ assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, alignment) == addr);
/*
* Ideally, there would be a way to specify alignment to mmap() (like
@@ -570,7 +570,7 @@ label_error:
bool
pages_boot(void) {
os_page = os_page_detect();
- if (os_page > PAGE) {
+ if (os_page < PAGE) {
malloc_write("<jemalloc>: Unsupported system page size\n");
if (opt_abort) {
abort();
diff --git a/external/bsd/jemalloc/dist/src/tsd.c b/external/bsd/jemalloc/dist/src/tsd.c
index c1430682dd5..8edf966e4c0 100644
--- a/external/bsd/jemalloc/dist/src/tsd.c
+++ b/external/bsd/jemalloc/dist/src/tsd.c
@@ -39,7 +39,10 @@ struct tsd_init_head_s {
pthread_key_t tsd_tsd;
tsd_init_head_t tsd_init_head = {
ql_head_initializer(blocks),
+#ifndef __lint__
+ // XXX: broken lint
MALLOC_MUTEX_INITIALIZER
+#endif
};
tsd_wrapper_t tsd_boot_wrapper = {
false,