Skip to content

Commit 896ed3a

Browse files
committed
Merge branch 'dev'
2 parents 5018fe3 + 284edf0 commit 896ed3a

23 files changed

+395
-134
lines changed

ChangeLog

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@ brevity. Much more detail can be found in the git revision history:
44

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

7+
* 5.0.1 (July 1, 2017)
8+
9+
This bugfix release fixes several issues, most of which are obscure enough
10+
that typical applications are not impacted.
11+
12+
Bug fixes:
13+
- Update decay->nunpurged before purging, in order to avoid potential update
14+
races and subsequent incorrect purging volume. (@interwq)
15+
- Only abort on dlsym(3) error if the failure impacts an enabled feature (lazy
16+
locking and/or background threads). This mitigates an initialization
17+
failure bug for which we still do not have a clear reproduction test case.
18+
(@interwq)
19+
- Modify tsd management so that it neither crashes nor leaks if a thread's
20+
only allocation activity is to call free() after TLS destructors have been
21+
executed. This behavior was observed when operating with GNU libc, and is
22+
unlikely to be an issue with other libc implementations. (@interwq)
23+
- Mask signals during background thread creation. This prevents signals from
24+
being inadvertently delivered to background threads. (@jasone,
25+
@davidgoldblatt, @interwq)
26+
- Avoid inactivity checks within background threads, in order to prevent
27+
recursive mutex acquisition. (@interwq)
28+
- Fix extent_grow_retained() to use the specified hooks when the
29+
arena.<i>.extent_hooks mallctl is used to override the default hooks.
30+
(@interwq)
31+
- Add missing reentrancy support for custom extent hooks which allocate.
32+
(@interwq)
33+
- Post-fork(2), re-initialize the list of tcaches associated with each arena
34+
to contain no tcaches except the forking thread's. (@interwq)
35+
- Add missing post-fork(2) mutex reinitialization for extent_grow_mtx. This
36+
fixes potential deadlocks after fork(2). (@interwq)
37+
- Enforce minimum autoconf version (currently 2.68), since 2.63 is known to
38+
generate corrupt configure scripts. (@jasone)
39+
- Ensure that the configured page size (--with-lg-page) is no larger than the
40+
configured huge page size (--with-lg-hugepage). (@jasone)
41+
742
* 5.0.0 (June 13, 2017)
843

944
Unlike all previous jemalloc releases, this release does not use naturally

configure.ac

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2+
AC_PREREQ(2.68)
23
AC_INIT([Makefile.in])
34

45
AC_CONFIG_AUX_DIR([build-aux])
@@ -1373,6 +1374,10 @@ if test "x${je_cv_lg_hugepage}" = "x" ; then
13731374
je_cv_lg_hugepage=21
13741375
fi
13751376
fi
1377+
if test "x${LG_PAGE}" != "xundefined" -a \
1378+
"${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then
1379+
AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})])
1380+
fi
13761381
AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
13771382

13781383
AC_ARG_WITH([lg_page_sizes],
@@ -1470,6 +1475,15 @@ if test "x$abi" != "xpecoff" ; then
14701475
if test "x${je_cv_pthread_atfork}" = "xyes" ; then
14711476
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ])
14721477
fi
1478+
dnl Check if pthread_setname_np is available with the expected API.
1479+
JE_COMPILABLE([pthread_setname_np(3)], [
1480+
#include <pthread.h>
1481+
], [
1482+
pthread_setname_np(pthread_self(), "setname_test");
1483+
], [je_cv_pthread_setname_np])
1484+
if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
1485+
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ])
1486+
fi
14731487
fi
14741488

14751489
JE_APPEND_VS(CPPFLAGS, -D_REENTRANT)

include/jemalloc/internal/arena_externs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void arena_prefork3(tsdn_t *tsdn, arena_t *arena);
9090
void arena_prefork4(tsdn_t *tsdn, arena_t *arena);
9191
void arena_prefork5(tsdn_t *tsdn, arena_t *arena);
9292
void arena_prefork6(tsdn_t *tsdn, arena_t *arena);
93+
void arena_prefork7(tsdn_t *tsdn, arena_t *arena);
9394
void arena_postfork_parent(tsdn_t *tsdn, arena_t *arena);
9495
void arena_postfork_child(tsdn_t *tsdn, arena_t *arena);
9596

include/jemalloc/internal/background_thread_externs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extern malloc_mutex_t background_thread_lock;
66
extern atomic_b_t background_thread_enabled_state;
77
extern size_t n_background_threads;
88
extern background_thread_info_t *background_thread_info;
9+
extern bool can_enable_background_thread;
910

1011
bool background_thread_create(tsd_t *tsd, unsigned arena_ind);
1112
bool background_threads_enable(tsd_t *tsd);

include/jemalloc/internal/background_thread_inlines.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ background_thread_indefinite_sleep(background_thread_info_t *info) {
4141
}
4242

4343
JEMALLOC_ALWAYS_INLINE void
44-
arena_background_thread_inactivity_check(tsdn_t *tsdn, arena_t *arena) {
45-
if (!background_thread_enabled()) {
44+
arena_background_thread_inactivity_check(tsdn_t *tsdn, arena_t *arena,
45+
bool is_background_thread) {
46+
if (!background_thread_enabled() || is_background_thread) {
4647
return;
4748
}
4849
background_thread_info_t *info =

include/jemalloc/internal/base_externs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
base_t *b0get(void);
55
base_t *base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks);
6-
void base_delete(base_t *base);
6+
void base_delete(tsdn_t *tsdn, base_t *base);
77
extent_hooks_t *base_extent_hooks_get(base_t *base);
88
extent_hooks_t *base_extent_hooks_set(base_t *base,
99
extent_hooks_t *extent_hooks);

include/jemalloc/internal/ctl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ typedef struct ctl_arenas_s {
9191

9292
int ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
9393
void *newp, size_t newlen);
94-
int ctl_nametomib(tsdn_t *tsdn, const char *name, size_t *mibp,
95-
size_t *miblenp);
94+
int ctl_nametomib(tsd_t *tsd, const char *name, size_t *mibp, size_t *miblenp);
9695

9796
int ctl_bymib(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
9897
size_t *oldlenp, void *newp, size_t newlen);

include/jemalloc/internal/jemalloc_internal_decls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# include <sys/uio.h>
2323
# endif
2424
# include <pthread.h>
25+
# include <signal.h>
2526
# ifdef JEMALLOC_OS_UNFAIR_LOCK
2627
# include <os/lock.h>
2728
# endif

include/jemalloc/internal/jemalloc_internal_defs.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
/* Defined if pthread_atfork(3) is available. */
9999
#undef JEMALLOC_HAVE_PTHREAD_ATFORK
100100

101+
/* Defined if pthread_setname_np(3) is available. */
102+
#undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
103+
101104
/*
102105
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
103106
*/

include/jemalloc/internal/jemalloc_internal_inlines_a.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ tcache_get(tsd_t *tsd) {
146146
}
147147

148148
static inline void
149-
pre_reentrancy(tsd_t *tsd) {
149+
pre_reentrancy(tsd_t *tsd, arena_t *arena) {
150+
/* arena is the current context. Reentry from a0 is not allowed. */
151+
assert(arena != arena_get(tsd_tsdn(tsd), 0, false));
152+
150153
bool fast = tsd_fast(tsd);
151154
++*tsd_reentrancy_levelp_get(tsd);
152155
if (fast) {

0 commit comments

Comments
 (0)