Make tsd cleanup functions optional, remove noop cleanup functions.

This commit is contained in:
Jason Evans 2016-06-02 11:11:35 -07:00
parent e28b43a739
commit 7be2ebc23f
11 changed files with 23 additions and 81 deletions

View File

@ -455,13 +455,9 @@ arena_t *arena_init(tsdn_t *tsdn, unsigned ind);
arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind); arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
arena_t *arena_choose_hard(tsd_t *tsd, bool internal); arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind); void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
void thread_allocated_cleanup(tsd_t *tsd);
void thread_deallocated_cleanup(tsd_t *tsd);
void iarena_cleanup(tsd_t *tsd); void iarena_cleanup(tsd_t *tsd);
void arena_cleanup(tsd_t *tsd); void arena_cleanup(tsd_t *tsd);
void arenas_tdata_cleanup(tsd_t *tsd); void arenas_tdata_cleanup(tsd_t *tsd);
void narenas_tdata_cleanup(tsd_t *tsd);
void arenas_tdata_bypass_cleanup(tsd_t *tsd);
void jemalloc_prefork(void); void jemalloc_prefork(void);
void jemalloc_postfork_parent(void); void jemalloc_postfork_parent(void);
void jemalloc_postfork_child(void); void jemalloc_postfork_child(void);

View File

@ -74,7 +74,6 @@ arena_tcache_fill_small
arena_tdata_get arena_tdata_get
arena_tdata_get_hard arena_tdata_get_hard
arenas arenas
arenas_tdata_bypass_cleanup
arenas_tdata_cleanup arenas_tdata_cleanup
atomic_add_p atomic_add_p
atomic_add_u atomic_add_u
@ -285,7 +284,6 @@ malloc_vsnprintf
malloc_write malloc_write
mb_write mb_write
narenas_auto narenas_auto
narenas_tdata_cleanup
narenas_total_get narenas_total_get
ncpus ncpus
nhbins nhbins
@ -410,7 +408,6 @@ rtree_elm_release
rtree_elm_witness_access rtree_elm_witness_access
rtree_elm_witness_acquire rtree_elm_witness_acquire
rtree_elm_witness_release rtree_elm_witness_release
rtree_elm_witnesses_cleanup
rtree_elm_write rtree_elm_write
rtree_elm_write_acquired rtree_elm_write_acquired
rtree_new rtree_new
@ -451,7 +448,6 @@ tcache_cleanup
tcache_create tcache_create
tcache_dalloc_large tcache_dalloc_large
tcache_dalloc_small tcache_dalloc_small
tcache_enabled_cleanup
tcache_enabled_get tcache_enabled_get
tcache_enabled_set tcache_enabled_set
tcache_event tcache_event
@ -467,8 +463,6 @@ tcaches_create
tcaches_destroy tcaches_destroy
tcaches_flush tcaches_flush
tcaches_get tcaches_get
thread_allocated_cleanup
thread_deallocated_cleanup
ticker_copy ticker_copy
ticker_init ticker_init
ticker_read ticker_read
@ -539,7 +533,6 @@ tsdn_tsd
witness_assert_lockless witness_assert_lockless
witness_assert_not_owner witness_assert_not_owner
witness_assert_owner witness_assert_owner
witness_fork_cleanup
witness_init witness_init
witness_lock witness_lock
witness_lock_error witness_lock_error

View File

@ -137,7 +137,6 @@ void rtree_elm_witness_access(tsdn_t *tsdn, const rtree_t *rtree,
const rtree_elm_t *elm); const rtree_elm_t *elm);
void rtree_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree, void rtree_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
const rtree_elm_t *elm); const rtree_elm_t *elm);
void rtree_elm_witnesses_cleanup(tsd_t *tsd);
#endif /* JEMALLOC_H_EXTERNS */ #endif /* JEMALLOC_H_EXTERNS */
/******************************************************************************/ /******************************************************************************/

View File

@ -143,7 +143,6 @@ void tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache,
tcache_t *tcache_get_hard(tsd_t *tsd); tcache_t *tcache_get_hard(tsd_t *tsd);
tcache_t *tcache_create(tsdn_t *tsdn, arena_t *arena); tcache_t *tcache_create(tsdn_t *tsdn, arena_t *arena);
void tcache_cleanup(tsd_t *tsd); void tcache_cleanup(tsd_t *tsd);
void tcache_enabled_cleanup(tsd_t *tsd);
void tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena); void tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena);
bool tcaches_create(tsdn_t *tsdn, unsigned *r_ind); bool tcaches_create(tsdn_t *tsdn, unsigned *r_ind);
void tcaches_flush(tsd_t *tsd, unsigned ind); void tcaches_flush(tsd_t *tsd, unsigned ind);

View File

@ -561,20 +561,20 @@ struct tsd_init_head_s {
#endif #endif
#define MALLOC_TSD \ #define MALLOC_TSD \
/* O(name, type) */ \ /* O(name, type, cleanup) */ \
O(tcache, tcache_t *) \ O(tcache, tcache_t *, yes) \
O(thread_allocated, uint64_t) \ O(thread_allocated, uint64_t, no) \
O(thread_deallocated, uint64_t) \ O(thread_deallocated, uint64_t, no) \
O(prof_tdata, prof_tdata_t *) \ O(prof_tdata, prof_tdata_t *, yes) \
O(iarena, arena_t *) \ O(iarena, arena_t *, yes) \
O(arena, arena_t *) \ O(arena, arena_t *, yes) \
O(arenas_tdata, arena_tdata_t *) \ O(arenas_tdata, arena_tdata_t *, yes) \
O(narenas_tdata, unsigned) \ O(narenas_tdata, unsigned, no) \
O(arenas_tdata_bypass, bool) \ O(arenas_tdata_bypass, bool, no) \
O(tcache_enabled, tcache_enabled_t) \ O(tcache_enabled, tcache_enabled_t, no) \
O(witnesses, witness_list_t) \ O(witnesses, witness_list_t, yes) \
O(rtree_elm_witnesses, rtree_elm_witness_tsd_t) \ O(rtree_elm_witnesses, rtree_elm_witness_tsd_t,no) \
O(witness_fork, bool) \ O(witness_fork, bool, no) \
#define TSD_INITIALIZER { \ #define TSD_INITIALIZER { \
tsd_state_uninitialized, \ tsd_state_uninitialized, \
@ -595,7 +595,7 @@ struct tsd_init_head_s {
struct tsd_s { struct tsd_s {
tsd_state_t state; tsd_state_t state;
#define O(n, t) \ #define O(n, t, c) \
t n; t n;
MALLOC_TSD MALLOC_TSD
#undef O #undef O
@ -642,7 +642,7 @@ malloc_tsd_protos(JEMALLOC_ATTR(unused), , tsd_t)
tsd_t *tsd_fetch(void); tsd_t *tsd_fetch(void);
tsdn_t *tsd_tsdn(tsd_t *tsd); tsdn_t *tsd_tsdn(tsd_t *tsd);
bool tsd_nominal(tsd_t *tsd); bool tsd_nominal(tsd_t *tsd);
#define O(n, t) \ #define O(n, t, c) \
t *tsd_##n##p_get(tsd_t *tsd); \ t *tsd_##n##p_get(tsd_t *tsd); \
t tsd_##n##_get(tsd_t *tsd); \ t tsd_##n##_get(tsd_t *tsd); \
void tsd_##n##_set(tsd_t *tsd, t n); void tsd_##n##_set(tsd_t *tsd, t n);
@ -691,7 +691,7 @@ tsd_nominal(tsd_t *tsd)
return (tsd->state == tsd_state_nominal); return (tsd->state == tsd_state_nominal);
} }
#define O(n, t) \ #define O(n, t, c) \
JEMALLOC_ALWAYS_INLINE t * \ JEMALLOC_ALWAYS_INLINE t * \
tsd_##n##p_get(tsd_t *tsd) \ tsd_##n##p_get(tsd_t *tsd) \
{ \ { \

View File

@ -103,7 +103,6 @@ void witness_lockless_error(const witness_list_t *witnesses);
#endif #endif
void witnesses_cleanup(tsd_t *tsd); void witnesses_cleanup(tsd_t *tsd);
void witness_fork_cleanup(tsd_t *tsd);
void witness_prefork(tsd_t *tsd); void witness_prefork(tsd_t *tsd);
void witness_postfork_parent(tsd_t *tsd); void witness_postfork_parent(tsd_t *tsd);
void witness_postfork_child(tsd_t *tsd); void witness_postfork_child(tsd_t *tsd);

View File

@ -644,20 +644,6 @@ arena_choose_hard(tsd_t *tsd, bool internal)
return (ret); return (ret);
} }
void
thread_allocated_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
void
thread_deallocated_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
void void
iarena_cleanup(tsd_t *tsd) iarena_cleanup(tsd_t *tsd)
{ {
@ -693,20 +679,6 @@ arenas_tdata_cleanup(tsd_t *tsd)
} }
} }
void
narenas_tdata_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
void
arenas_tdata_bypass_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
static void static void
stats_print_atexit(void) stats_print_atexit(void)
{ {

View File

@ -285,10 +285,3 @@ rtree_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
witness_unlock(tsdn, witness); witness_unlock(tsdn, witness);
rtree_elm_witness_dalloc(tsdn_tsd(tsdn), witness, elm); rtree_elm_witness_dalloc(tsdn_tsd(tsdn), witness, elm);
} }
void
rtree_elm_witnesses_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}

View File

@ -404,13 +404,6 @@ tcache_cleanup(tsd_t *tsd)
} }
} }
void
tcache_enabled_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
void void
tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
{ {

View File

@ -77,9 +77,14 @@ tsd_cleanup(void *arg)
/* Do nothing. */ /* Do nothing. */
break; break;
case tsd_state_nominal: case tsd_state_nominal:
#define O(n, t) \ #define MALLOC_TSD_cleanup_yes(n, t) \
n##_cleanup(tsd); n##_cleanup(tsd);
#define MALLOC_TSD_cleanup_no(n, t)
#define O(n, t, c) \
MALLOC_TSD_cleanup_##c(n, t)
MALLOC_TSD MALLOC_TSD
#undef MALLOC_TSD_cleanup_yes
#undef MALLOC_TSD_cleanup_no
#undef O #undef O
tsd->state = tsd_state_purgatory; tsd->state = tsd_state_purgatory;
tsd_set(tsd); tsd_set(tsd);

View File

@ -103,13 +103,6 @@ witnesses_cleanup(tsd_t *tsd)
/* Do nothing. */ /* Do nothing. */
} }
void
witness_fork_cleanup(tsd_t *tsd)
{
/* Do nothing. */
}
void void
witness_prefork(tsd_t *tsd) witness_prefork(tsd_t *tsd)
{ {