Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 46c0af6

Browse files
committed
Merge branch 'dev'
2 parents 7709a64 + 8a26eac commit 46c0af6

29 files changed

+177
-88
lines changed

ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ found in the git revision history:
55

66
https://github.com/jemalloc/jemalloc
77

8+
* 3.6.0 (March 31, 2014)
9+
10+
This version contains a critical bug fix for a regression present in 3.5.0 and
11+
3.5.1.
12+
13+
Bug fixes:
14+
- Fix a regression in arena_chunk_alloc() that caused crashes during
15+
small/large allocation if chunk allocation failed. In the absence of this
16+
bug, chunk allocation failure would result in allocation failure, e.g. NULL
17+
return from malloc(). This regression was introduced in 3.5.0.
18+
- Fix backtracing for gcc intrinsics-based backtracing by specifying
19+
-fno-omit-frame-pointer to gcc. Note that the application (and all the
20+
libraries it links to) must also be compiled with this option for
21+
backtracing to be reliable.
22+
- Use dss allocation precedence for huge allocations as well as small/large
23+
allocations.
24+
- Fix test assertion failure message formatting. This bug did not manifect on
25+
x86_64 systems because of implementation subtleties in va_list.
26+
- Fix inconsequential test failures for hash and SFMT code.
27+
28+
New features:
29+
- Support heap profiling on FreeBSD. This feature depends on the proc
30+
filesystem being mounted during heap profile dumping.
31+
832
* 3.5.1 (February 25, 2014)
933

1034
This version primarily addresses minor bugs in test code.

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
141141
$(srcroot)test/integration/xallocx.c
142142
ifeq ($(enable_experimental), 1)
143143
TESTS_INTEGRATION += $(srcroot)test/integration/allocm.c \
144-
$(srcroot)test/integration/ALLOCM_ARENA.c \
144+
$(srcroot)test/integration/MALLOCX_ARENA.c \
145145
$(srcroot)test/integration/rallocm.c
146146
endif
147147
TESTS_STRESS :=

bin/pprof

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4197,8 +4197,12 @@ sub FindLibrary {
41974197
# For libc libraries, the copy in /usr/lib/debug contains debugging symbols
41984198
sub DebuggingLibrary {
41994199
my $file = shift;
4200-
if ($file =~ m|^/| && -f "/usr/lib/debug$file") {
4201-
return "/usr/lib/debug$file";
4200+
if ($file =~ m|^/|) {
4201+
if (-f "/usr/lib/debug$file") {
4202+
return "/usr/lib/debug$file";
4203+
} elsif (-f "/usr/lib/debug$file.debug") {
4204+
return "/usr/lib/debug$file.debug";
4205+
}
42024206
}
42034207
return undef;
42044208
}
@@ -4360,6 +4364,19 @@ sub ParseLibraries {
43604364
$finish = HexExtend($2);
43614365
$offset = $zero_offset;
43624366
$lib = $3;
4367+
}
4368+
# FreeBSD 10.0 virtual memory map /proc/curproc/map as defined in
4369+
# function procfs_doprocmap (sys/fs/procfs/procfs_map.c)
4370+
#
4371+
# Example:
4372+
# 0x800600000 0x80061a000 26 0 0xfffff800035a0000 r-x 75 33 0x1004 COW NC vnode /libexec/ld-elf.s
4373+
# o.1 NCH -1
4374+
elsif ($l =~ /^(0x$h)\s(0x$h)\s\d+\s\d+\s0x$h\sr-x\s\d+\s\d+\s0x\d+\s(COW|NCO)\s(NC|NNC)\svnode\s(\S+\.so(\.\d+)*)/) {
4375+
$start = HexExtend($1);
4376+
$finish = HexExtend($2);
4377+
$offset = $zero_offset;
4378+
$lib = FindLibrary($5);
4379+
43634380
} else {
43644381
next;
43654382
}
@@ -4382,6 +4399,7 @@ sub ParseLibraries {
43824399
}
43834400
}
43844401

4402+
if($main::opt_debug) { printf STDERR "$start:$finish ($offset) $lib\n"; }
43854403
push(@{$result}, [$lib, $start, $finish, $offset]);
43864404
}
43874405

@@ -4589,6 +4607,12 @@ sub ExtractSymbols {
45894607
my $finish = $lib->[2];
45904608
my $offset = $lib->[3];
45914609

4610+
# Use debug library if it exists
4611+
my $debug_libname = DebuggingLibrary($libname);
4612+
if ($debug_libname) {
4613+
$libname = $debug_libname;
4614+
}
4615+
45924616
# Get list of pcs that belong in this library.
45934617
my $contained = [];
45944618
my ($start_pc_index, $finish_pc_index);
@@ -5019,7 +5043,7 @@ sub GetProcedureBoundariesViaNm {
50195043

50205044
# Tag this routine with the starting address in case the image
50215045
# has multiple occurrences of this routine. We use a syntax
5022-
# that resembles template paramters that are automatically
5046+
# that resembles template parameters that are automatically
50235047
# stripped out by ShortFunctionName()
50245048
$this_routine .= "<$start_val>";
50255049

configure.ac

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ if test "x$EXTRA_CFLAGS" != "x" ; then
150150
fi
151151
AC_PROG_CPP
152152

153+
AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
154+
if test "x${ac_cv_big_endian}" = "x1" ; then
155+
AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
156+
fi
157+
153158
AC_CHECK_SIZEOF([void *])
154159
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
155160
LG_SIZEOF_PTR=3
@@ -742,22 +747,6 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
742747
-a "x$GCC" = "xyes" ; then
743748
AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
744749
AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
745-
dnl The following is conservative, in that it only has entries for CPUs on
746-
dnl which jemalloc has been tested.
747-
AC_MSG_CHECKING([libgcc-based backtracing reliability on ${host_cpu}])
748-
case "${host_cpu}" in
749-
i[[3456]]86)
750-
AC_MSG_RESULT([unreliable])
751-
enable_prof_libgcc="0";
752-
;;
753-
x86_64)
754-
AC_MSG_RESULT([reliable])
755-
;;
756-
*)
757-
AC_MSG_RESULT([unreliable])
758-
enable_prof_libgcc="0";
759-
;;
760-
esac
761750
if test "x${enable_prof_libgcc}" = "x1" ; then
762751
backtrace_method="libgcc"
763752
AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
@@ -779,6 +768,7 @@ fi
779768
)
780769
if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
781770
-a "x$GCC" = "xyes" ; then
771+
JE_CFLAGS_APPEND([-fno-omit-frame-pointer])
782772
backtrace_method="gcc intrinsics"
783773
AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
784774
else

doc/jemalloc.xml.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,12 @@ malloc_conf = "xmalloc:true";]]></programlisting>
14391439
<listitem><para>Set the precedence of dss allocation as related to mmap
14401440
allocation for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals
14411441
<link
1442-
linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>. See
1443-
<link linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported
1442+
linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>. Note
1443+
that even during huge allocation this setting is read from the arena
1444+
that would be chosen for small or large allocation so that applications
1445+
can depend on consistent dss versus mmap allocation regardless of
1446+
allocation size. See <link
1447+
linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported
14441448
settings.
14451449
</para></listitem>
14461450
</varlistentry>

include/jemalloc/internal/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ hash_x64_128(const void *key, const int len, const uint32_t seed,
320320
JEMALLOC_INLINE void
321321
hash(const void *key, size_t len, const uint32_t seed, size_t r_hash[2])
322322
{
323-
#if (LG_SIZEOF_PTR == 3)
323+
#if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN))
324324
hash_x64_128(key, len, seed, (uint64_t *)r_hash);
325325
#else
326326
uint64_t hashes[2];

include/jemalloc/internal/huge.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ extern size_t huge_allocated;
1717
/* Protects chunk-related data structures. */
1818
extern malloc_mutex_t huge_mtx;
1919

20-
void *huge_malloc(size_t size, bool zero);
21-
void *huge_palloc(size_t size, size_t alignment, bool zero);
20+
void *huge_malloc(size_t size, bool zero, dss_prec_t dss_prec);
21+
void *huge_palloc(size_t size, size_t alignment, bool zero,
22+
dss_prec_t dss_prec);
2223
bool huge_ralloc_no_move(void *ptr, size_t oldsize, size_t size,
2324
size_t extra);
2425
void *huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra,
25-
size_t alignment, bool zero, bool try_tcache_dalloc);
26+
size_t alignment, bool zero, bool try_tcache_dalloc, dss_prec_t dss_prec);
2627
#ifdef JEMALLOC_JET
2728
typedef void (huge_dalloc_junk_t)(void *, size_t);
2829
extern huge_dalloc_junk_t *huge_dalloc_junk;
2930
#endif
3031
void huge_dalloc(void *ptr, bool unmap);
3132
size_t huge_salloc(const void *ptr);
33+
dss_prec_t huge_dss_prec_get(arena_t *arena);
3234
prof_ctx_t *huge_prof_ctx_get(const void *ptr);
3335
void huge_prof_ctx_set(const void *ptr, prof_ctx_t *ctx);
3436
bool huge_boot(void);

include/jemalloc/internal/jemalloc_internal.h.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ imalloct(size_t size, bool try_tcache, arena_t *arena)
770770
if (size <= arena_maxclass)
771771
return (arena_malloc(arena, size, false, try_tcache));
772772
else
773-
return (huge_malloc(size, false));
773+
return (huge_malloc(size, false, huge_dss_prec_get(arena)));
774774
}
775775

776776
JEMALLOC_ALWAYS_INLINE void *
@@ -787,7 +787,7 @@ icalloct(size_t size, bool try_tcache, arena_t *arena)
787787
if (size <= arena_maxclass)
788788
return (arena_malloc(arena, size, true, try_tcache));
789789
else
790-
return (huge_malloc(size, true));
790+
return (huge_malloc(size, true, huge_dss_prec_get(arena)));
791791
}
792792

793793
JEMALLOC_ALWAYS_INLINE void *
@@ -813,9 +813,9 @@ ipalloct(size_t usize, size_t alignment, bool zero, bool try_tcache,
813813
ret = arena_palloc(choose_arena(arena), usize,
814814
alignment, zero);
815815
} else if (alignment <= chunksize)
816-
ret = huge_malloc(usize, zero);
816+
ret = huge_malloc(usize, zero, huge_dss_prec_get(arena));
817817
else
818-
ret = huge_palloc(usize, alignment, zero);
818+
ret = huge_palloc(usize, alignment, zero, huge_dss_prec_get(arena));
819819
}
820820

821821
assert(ALIGNMENT_ADDR2BASE(ret, alignment) == ret);
@@ -984,7 +984,7 @@ iralloct(void *ptr, size_t size, size_t extra, size_t alignment, bool zero,
984984
try_tcache_dalloc));
985985
} else {
986986
return (huge_ralloc(ptr, oldsize, size, extra,
987-
alignment, zero, try_tcache_dalloc));
987+
alignment, zero, try_tcache_dalloc, huge_dss_prec_get(arena)));
988988
}
989989
}
990990

include/jemalloc/internal/jemalloc_internal_defs.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@
190190
/* C99 restrict keyword supported. */
191191
#undef JEMALLOC_HAS_RESTRICT
192192

193+
/* For use by hash code. */
194+
#undef JEMALLOC_BIG_ENDIAN
195+
193196
/* sizeof(int) == 2^LG_SIZEOF_INT. */
194197
#undef LG_SIZEOF_INT
195198

include/jemalloc/internal/private_symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ huge_allocated
197197
huge_boot
198198
huge_dalloc
199199
huge_dalloc_junk
200+
huge_dss_prec_get
200201
huge_malloc
201202
huge_mtx
202203
huge_ndalloc

0 commit comments

Comments
 (0)