Author: jasone
Date: Sat Oct 24 23:18:05 2015
New Revision: 289900
URL: https://svnweb.freebsd.org/changeset/base/289900

Log:
  Update jemalloc to version 4.0.4.

Modified:
  head/contrib/jemalloc/ChangeLog
  head/contrib/jemalloc/FREEBSD-diffs
  head/contrib/jemalloc/VERSION
  head/contrib/jemalloc/doc/jemalloc.3
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
  head/contrib/jemalloc/include/jemalloc/jemalloc.h
  head/contrib/jemalloc/src/arena.c
  head/contrib/jemalloc/src/huge.c
  head/contrib/jemalloc/src/prof.c
  head/contrib/jemalloc/src/tsd.c

Modified: head/contrib/jemalloc/ChangeLog
==============================================================================
--- head/contrib/jemalloc/ChangeLog     Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/ChangeLog     Sat Oct 24 23:18:05 2015        
(r289900)
@@ -4,6 +4,32 @@ brevity.  Much more detail can be found 
 
     https://github.com/jemalloc/jemalloc
 
+* 4.0.4 (October 24, 2015)
+
+  This bugfix release fixes another xallocx() regression.  No other regressions
+  have come to light in over a month, so this is likely a good starting point
+  for people who prefer to wait for "dot one" releases with all the major 
issues
+  shaken out.
+
+  Bug fixes:
+  - Fix xallocx(..., MALLOCX_ZERO to zero the last full trailing page of large
+    allocations that have been randomly assigned an offset of 0 when
+    --enable-cache-oblivious configure option is enabled.
+
+* 4.0.3 (September 24, 2015)
+
+  This bugfix release continues the trend of xallocx() and heap profiling 
fixes.
+
+  Bug fixes:
+  - Fix xallocx(..., MALLOCX_ZERO) to zero all trailing bytes of large
+    allocations when --enable-cache-oblivious configure option is enabled.
+  - Fix xallocx(..., MALLOCX_ZERO) to zero trailing bytes of huge allocations
+    when resizing from/to a size class that is not a multiple of the chunk 
size.
+  - Fix prof_tctx_dump_iter() to filter out nodes that were created after heap
+    profile dumping started.
+  - Work around a potentially bad thread-specific data initialization
+    interaction with NPTL (glibc's pthreads implementation).
+
 * 4.0.2 (September 21, 2015)
 
   This bugfix release addresses a few bugs specific to heap profiling.

Modified: head/contrib/jemalloc/FREEBSD-diffs
==============================================================================
--- head/contrib/jemalloc/FREEBSD-diffs Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/FREEBSD-diffs Sat Oct 24 23:18:05 2015        
(r289900)
@@ -1,5 +1,5 @@
 diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
-index 8fc774b..fdbef95 100644
+index 26a5e14..2a801b7 100644
 --- a/doc/jemalloc.xml.in
 +++ b/doc/jemalloc.xml.in
 @@ -53,11 +53,23 @@
@@ -47,7 +47,7 @@ index 8fc774b..fdbef95 100644
 +  </refsect1>
  </refentry>
 diff --git a/include/jemalloc/internal/jemalloc_internal.h.in 
b/include/jemalloc/internal/jemalloc_internal.h.in
-index 8536a3e..0c2a81f 100644
+index 654cd08..ad5382d 100644
 --- a/include/jemalloc/internal/jemalloc_internal.h.in
 +++ b/include/jemalloc/internal/jemalloc_internal.h.in
 @@ -8,6 +8,9 @@

Modified: head/contrib/jemalloc/VERSION
==============================================================================
--- head/contrib/jemalloc/VERSION       Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/VERSION       Sat Oct 24 23:18:05 2015        
(r289900)
@@ -1 +1 @@
-4.0.2-0-g486d249fb4715fd3de679b6c2a04f7e657883111
+4.0.4-0-g91010a9e2ebfc84b1ac1ed7fdde3bfed4f65f180

Modified: head/contrib/jemalloc/doc/jemalloc.3
==============================================================================
--- head/contrib/jemalloc/doc/jemalloc.3        Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/doc/jemalloc.3        Sat Oct 24 23:18:05 2015        
(r289900)
@@ -2,12 +2,12 @@
 .\"     Title: JEMALLOC
 .\"    Author: Jason Evans
 .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\"      Date: 09/21/2015
+.\"      Date: 10/24/2015
 .\"    Manual: User Manual
-.\"    Source: jemalloc 4.0.2-0-g486d249fb4715fd3de679b6c2a04f7e657883111
+.\"    Source: jemalloc 4.0.4-0-g91010a9e2ebfc84b1ac1ed7fdde3bfed4f65f180
 .\"  Language: English
 .\"
-.TH "JEMALLOC" "3" "09/21/2015" "jemalloc 4.0.2-0-g486d249fb471" "User Manual"
+.TH "JEMALLOC" "3" "10/24/2015" "jemalloc 4.0.4-0-g91010a9e2ebf" "User Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -31,7 +31,7 @@
 jemalloc \- general purpose memory allocation functions
 .SH "LIBRARY"
 .PP
-This manual describes jemalloc 
4\&.0\&.2\-0\-g486d249fb4715fd3de679b6c2a04f7e657883111\&. More information can 
be found at the
+This manual describes jemalloc 
4\&.0\&.4\-0\-g91010a9e2ebfc84b1ac1ed7fdde3bfed4f65f180\&. More information can 
be found at the
 \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
 .PP
 The following configuration options are enabled in libc\*(Aqs built\-in 
jemalloc:
@@ -1041,7 +1041,7 @@ Flush calling thread\*(Aqs thread\-speci
 .PP
 "thread\&.prof\&.name" (\fBconst char *\fR) r\- or \-w [\fB\-\-enable\-prof\fR]
 .RS 4
-Get/set the descriptive name associated with the calling thread in memory 
profile dumps\&. An internal copy of the name string is created, so the input 
string need not be maintained after this interface completes execution\&. The 
output string of this interface should be copied for non\-ephemeral uses, 
because multiple implementation details can cause asynchronous string 
deallocation\&. Furthermore, each invocation of this interface can only read or 
write; simultaneous read/write is not supported due to string lifetime 
limitations\&. The name string must nil\-terminated and comprised only of 
characters in the sets recognized by
+Get/set the descriptive name associated with the calling thread in memory 
profile dumps\&. An internal copy of the name string is created, so the input 
string need not be maintained after this interface completes execution\&. The 
output string of this interface should be copied for non\-ephemeral uses, 
because multiple implementation details can cause asynchronous string 
deallocation\&. Furthermore, each invocation of this interface can only read or 
write; simultaneous read/write is not supported due to string lifetime 
limitations\&. The name string must be nil\-terminated and comprised only of 
characters in the sets recognized by
 \fBisgraph\fR(3)
 and
 \fBisblank\fR(3)\&.

Modified: head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
==============================================================================
--- head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Sat Oct 
24 23:16:13 2015        (r289899)
+++ head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Sat Oct 
24 23:18:05 2015        (r289900)
@@ -314,6 +314,10 @@ typedef unsigned szind_t;
 #define        PAGE            ((size_t)(1U << LG_PAGE))
 #define        PAGE_MASK       ((size_t)(PAGE - 1))
 
+/* Return the page base address for the page containing address a. */
+#define        PAGE_ADDR2BASE(a)                                               
\
+       ((void *)((uintptr_t)(a) & ~PAGE_MASK))
+
 /* Return the smallest pagesize multiple that is >= s. */
 #define        PAGE_CEILING(s)                                                 
\
        (((s) + PAGE_MASK) & ~PAGE_MASK)

Modified: head/contrib/jemalloc/include/jemalloc/jemalloc.h
==============================================================================
--- head/contrib/jemalloc/include/jemalloc/jemalloc.h   Sat Oct 24 23:16:13 
2015        (r289899)
+++ head/contrib/jemalloc/include/jemalloc/jemalloc.h   Sat Oct 24 23:18:05 
2015        (r289900)
@@ -79,12 +79,12 @@ extern "C" {
 #include <limits.h>
 #include <strings.h>
 
-#define        JEMALLOC_VERSION 
"4.0.2-0-g486d249fb4715fd3de679b6c2a04f7e657883111"
+#define        JEMALLOC_VERSION 
"4.0.4-0-g91010a9e2ebfc84b1ac1ed7fdde3bfed4f65f180"
 #define        JEMALLOC_VERSION_MAJOR 4
 #define        JEMALLOC_VERSION_MINOR 0
-#define        JEMALLOC_VERSION_BUGFIX 2
+#define        JEMALLOC_VERSION_BUGFIX 4
 #define        JEMALLOC_VERSION_NREV 0
-#define        JEMALLOC_VERSION_GID "486d249fb4715fd3de679b6c2a04f7e657883111"
+#define        JEMALLOC_VERSION_GID "91010a9e2ebfc84b1ac1ed7fdde3bfed4f65f180"
 
 #  define MALLOCX_LG_ALIGN(la) (la)
 #  if LG_SIZEOF_PTR == 2

Modified: head/contrib/jemalloc/src/arena.c
==============================================================================
--- head/contrib/jemalloc/src/arena.c   Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/src/arena.c   Sat Oct 24 23:18:05 2015        
(r289900)
@@ -2679,6 +2679,22 @@ arena_ralloc_large_grow(arena_t *arena, 
                if (arena_run_split_large(arena, run, splitsize, zero))
                        goto label_fail;
 
+               if (config_cache_oblivious && zero) {
+                       /*
+                        * Zero the trailing bytes of the original allocation's
+                        * last page, since they are in an indeterminate state.
+                        * There will always be trailing bytes, because ptr's
+                        * offset from the beginning of the run is a multiple of
+                        * CACHELINE in [0 .. PAGE).
+                        */
+                       void *zbase = (void *)((uintptr_t)ptr + oldsize);
+                       void *zpast = PAGE_ADDR2BASE((void *)((uintptr_t)zbase +
+                           PAGE));
+                       size_t nzero = (uintptr_t)zpast - (uintptr_t)zbase;
+                       assert(nzero > 0);
+                       memset(zbase, 0, nzero);
+               }
+
                size = oldsize + splitsize;
                npages = (size + large_pad) >> LG_PAGE;
 

Modified: head/contrib/jemalloc/src/huge.c
==============================================================================
--- head/contrib/jemalloc/src/huge.c    Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/src/huge.c    Sat Oct 24 23:18:05 2015        
(r289900)
@@ -133,7 +133,7 @@ huge_ralloc_no_move_similar(void *ptr, s
        extent_node_t *node;
        arena_t *arena;
        chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
-       bool zeroed;
+       bool pre_zeroed, post_zeroed;
 
        /* Increase usize to incorporate extra. */
        for (usize = usize_min; usize < usize_max && (usize_next = s2u(usize+1))
@@ -145,26 +145,27 @@ huge_ralloc_no_move_similar(void *ptr, s
 
        node = huge_node_get(ptr);
        arena = extent_node_arena_get(node);
+       pre_zeroed = extent_node_zeroed_get(node);
 
        /* Fill if necessary (shrinking). */
        if (oldsize > usize) {
                size_t sdiff = oldsize - usize;
                if (config_fill && unlikely(opt_junk_free)) {
                        memset((void *)((uintptr_t)ptr + usize), 0x5a, sdiff);
-                       zeroed = false;
+                       post_zeroed = false;
                } else {
-                       zeroed = !chunk_purge_wrapper(arena, &chunk_hooks, ptr,
-                           CHUNK_CEILING(oldsize), usize, sdiff);
+                       post_zeroed = !chunk_purge_wrapper(arena, &chunk_hooks,
+                           ptr, CHUNK_CEILING(oldsize), usize, sdiff);
                }
        } else
-               zeroed = true;
+               post_zeroed = pre_zeroed;
 
        malloc_mutex_lock(&arena->huge_mtx);
        /* Update the size of the huge allocation. */
        assert(extent_node_size_get(node) != usize);
        extent_node_size_set(node, usize);
-       /* Clear node's zeroed field if zeroing failed above. */
-       extent_node_zeroed_set(node, extent_node_zeroed_get(node) && zeroed);
+       /* Update zeroed. */
+       extent_node_zeroed_set(node, post_zeroed);
        malloc_mutex_unlock(&arena->huge_mtx);
 
        arena_chunk_ralloc_huge_similar(arena, ptr, oldsize, usize);
@@ -172,7 +173,7 @@ huge_ralloc_no_move_similar(void *ptr, s
        /* Fill if necessary (growing). */
        if (oldsize < usize) {
                if (zero || (config_fill && unlikely(opt_zero))) {
-                       if (!zeroed) {
+                       if (!pre_zeroed) {
                                memset((void *)((uintptr_t)ptr + oldsize), 0,
                                    usize - oldsize);
                        }
@@ -190,10 +191,11 @@ huge_ralloc_no_move_shrink(void *ptr, si
        arena_t *arena;
        chunk_hooks_t chunk_hooks;
        size_t cdiff;
-       bool zeroed;
+       bool pre_zeroed, post_zeroed;
 
        node = huge_node_get(ptr);
        arena = extent_node_arena_get(node);
+       pre_zeroed = extent_node_zeroed_get(node);
        chunk_hooks = chunk_hooks_get(arena);
 
        assert(oldsize > usize);
@@ -209,21 +211,21 @@ huge_ralloc_no_move_shrink(void *ptr, si
                if (config_fill && unlikely(opt_junk_free)) {
                        huge_dalloc_junk((void *)((uintptr_t)ptr + usize),
                            sdiff);
-                       zeroed = false;
+                       post_zeroed = false;
                } else {
-                       zeroed = !chunk_purge_wrapper(arena, &chunk_hooks,
+                       post_zeroed = !chunk_purge_wrapper(arena, &chunk_hooks,
                            CHUNK_ADDR2BASE((uintptr_t)ptr + usize),
                            CHUNK_CEILING(oldsize),
                            CHUNK_ADDR2OFFSET((uintptr_t)ptr + usize), sdiff);
                }
        } else
-               zeroed = true;
+               post_zeroed = pre_zeroed;
 
        malloc_mutex_lock(&arena->huge_mtx);
        /* Update the size of the huge allocation. */
        extent_node_size_set(node, usize);
-       /* Clear node's zeroed field if zeroing failed above. */
-       extent_node_zeroed_set(node, extent_node_zeroed_get(node) && zeroed);
+       /* Update zeroed. */
+       extent_node_zeroed_set(node, post_zeroed);
        malloc_mutex_unlock(&arena->huge_mtx);
 
        /* Zap the excess chunks. */

Modified: head/contrib/jemalloc/src/prof.c
==============================================================================
--- head/contrib/jemalloc/src/prof.c    Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/src/prof.c    Sat Oct 24 23:18:05 2015        
(r289900)
@@ -1102,11 +1102,23 @@ prof_tctx_dump_iter(prof_tctx_tree_t *tc
 {
        bool propagate_err = *(bool *)arg;
 
-       if (prof_dump_printf(propagate_err,
-           "  t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
-           tctx->thr_uid, tctx->dump_cnts.curobjs, tctx->dump_cnts.curbytes,
-           tctx->dump_cnts.accumobjs, tctx->dump_cnts.accumbytes))
-               return (tctx);
+       switch (tctx->state) {
+       case prof_tctx_state_initializing:
+       case prof_tctx_state_nominal:
+               /* Not captured by this dump. */
+               break;
+       case prof_tctx_state_dumping:
+       case prof_tctx_state_purgatory:
+               if (prof_dump_printf(propagate_err,
+                   "  t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": "
+                   "%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs,
+                   tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs,
+                   tctx->dump_cnts.accumbytes))
+                       return (tctx);
+               break;
+       default:
+               not_reached();
+       }
        return (NULL);
 }
 

Modified: head/contrib/jemalloc/src/tsd.c
==============================================================================
--- head/contrib/jemalloc/src/tsd.c     Sat Oct 24 23:16:13 2015        
(r289899)
+++ head/contrib/jemalloc/src/tsd.c     Sat Oct 24 23:18:05 2015        
(r289900)
@@ -73,6 +73,9 @@ tsd_cleanup(void *arg)
        tsd_t *tsd = (tsd_t *)arg;
 
        switch (tsd->state) {
+       case tsd_state_uninitialized:
+               /* Do nothing. */
+               break;
        case tsd_state_nominal:
 #define O(n, t)                                                                
\
                n##_cleanup(tsd);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to