Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/jemalloc/dist/src Allow os_page sizes greater t...



details:   https://anonhg.NetBSD.org/src/rev/447d0de5f200
branches:  trunk
changeset: 456136:447d0de5f200
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 24 14:34:21 2019 +0000

description:
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:

 external/bsd/jemalloc/dist/src/pages.c |  12 ++++++------
 external/bsd/jemalloc/dist/src/tsd.c   |   3 +++
 2 files changed, 9 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 574c10a4f714 -r 447d0de5f200 external/bsd/jemalloc/dist/src/pages.c
--- a/external/bsd/jemalloc/dist/src/pages.c    Wed Apr 24 14:15:35 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/pages.c    Wed Apr 24 14:34:21 2019 +0000
@@ -55,8 +55,8 @@
 
 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 @@
 
 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 @@
 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 @@
 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 -r 574c10a4f714 -r 447d0de5f200 external/bsd/jemalloc/dist/src/tsd.c
--- a/external/bsd/jemalloc/dist/src/tsd.c      Wed Apr 24 14:15:35 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/tsd.c      Wed Apr 24 14:34:21 2019 +0000
@@ -39,7 +39,10 @@
 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,



Home | Main Index | Thread Index | Old Index