Source-Changes-HG archive

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

[src-draft/trunk]: src/share/mk Adjust fork handling in new jemalloc, switch ...



details:   https://anonhg.NetBSD.org/src-all/rev/68225b6fd5c6
branches:  trunk
changeset: 931812:68225b6fd5c6
user:      Joerg Sonnenberger <joerg%bec.de@localhost>
date:      Thu Apr 30 16:33:06 2020 +0200

description:
Adjust fork handling in new jemalloc, switch back to it for testing

diffstat:

 external/bsd/jemalloc/dist/src/jemalloc.c |  18 ++++++++++++++----
 external/bsd/jemalloc/dist/src/mutex.c    |   3 +++
 share/mk/bsd.own.mk                       |   2 +-
 3 files changed, 18 insertions(+), 5 deletions(-)

diffs (81 lines):

diff -r 3f22de6e9559 -r 68225b6fd5c6 external/bsd/jemalloc/dist/src/jemalloc.c
--- a/external/bsd/jemalloc/dist/src/jemalloc.c Thu Apr 30 16:32:39 2020 +0200
+++ b/external/bsd/jemalloc/dist/src/jemalloc.c Thu Apr 30 16:33:06 2020 +0200
@@ -1,5 +1,9 @@
 #include <sys/cdefs.h>
 
+#ifdef __NetBSD__
+#include "extern.h"
+#endif
+
 #define JEMALLOC_C_
 #include "jemalloc/internal/jemalloc_preamble.h"
 #include "jemalloc/internal/jemalloc_internal_includes.h"
@@ -1383,7 +1387,7 @@
 
 #if (defined(JEMALLOC_HAVE_PTHREAD_ATFORK) && !defined(JEMALLOC_MUTEX_INIT_CB) \
     && !defined(JEMALLOC_ZONE) && !defined(_WIN32) && \
-    !defined(__native_client__))
+    !defined(__native_client__) && !defined(__NetBSD__))
        /* LinuxThreads' pthread_atfork() allocates. */
        if (pthread_atfork(jemalloc_prefork, jemalloc_postfork_parent,
            jemalloc_postfork_child) != 0) {
@@ -3221,7 +3225,7 @@
 }
 #endif
 
-#ifndef JEMALLOC_MUTEX_INIT_CB
+#if !defined(JEMALLOC_MUTEX_INIT_CB) && !defined(__NetBSD__)
 void
 jemalloc_prefork(void)
 #else
@@ -3294,7 +3298,7 @@
        prof_prefork1(tsd_tsdn(tsd));
 }
 
-#ifndef JEMALLOC_MUTEX_INIT_CB
+#if !defined(JEMALLOC_MUTEX_INIT_CB) && !defined(__NetBSD__)
 void
 jemalloc_postfork_parent(void)
 #else
@@ -3332,8 +3336,14 @@
        ctl_postfork_parent(tsd_tsdn(tsd));
 }
 
+#if !defined(__NetBSD__)
 void
-jemalloc_postfork_child(void) {
+jemalloc_postfork_child(void)
+#else
+JEMALLOC_EXPORT void
+_malloc_postfork_child(void)
+#endif
+{
        tsd_t *tsd;
        unsigned i, narenas;
 
diff -r 3f22de6e9559 -r 68225b6fd5c6 external/bsd/jemalloc/dist/src/mutex.c
--- a/external/bsd/jemalloc/dist/src/mutex.c    Thu Apr 30 16:32:39 2020 +0200
+++ b/external/bsd/jemalloc/dist/src/mutex.c    Thu Apr 30 16:33:06 2020 +0200
@@ -157,6 +157,9 @@
                        return true;
                }
        }
+#elif MALLOC_MUTEX_TYPE == PTHREAD_MUTEX_DEFAULT
+       if (pthread_mutex_init(&mutex->lock, NULL) == -1)
+               return true;
 #else
        pthread_mutexattr_t attr;
 
diff -r 3f22de6e9559 -r 68225b6fd5c6 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Thu Apr 30 16:32:39 2020 +0200
+++ b/share/mk/bsd.own.mk       Thu Apr 30 16:33:06 2020 +0200
@@ -182,7 +182,7 @@
 # What version of jemalloc we use (100 is the one
 # built-in to libc from 2005 (pre version 3).
 #
-HAVE_JEMALLOC?=                100
+HAVE_JEMALLOC?=                510
 
 .if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*)
 .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)



Home | Main Index | Thread Index | Old Index