Make tsd cleanup functions optional, remove noop cleanup functions.
This commit is contained in:
parent
e28b43a739
commit
7be2ebc23f
@ -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_t *arena_choose_hard(tsd_t *tsd, bool internal);
|
||||
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 arena_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_postfork_parent(void);
|
||||
void jemalloc_postfork_child(void);
|
||||
|
@ -74,7 +74,6 @@ arena_tcache_fill_small
|
||||
arena_tdata_get
|
||||
arena_tdata_get_hard
|
||||
arenas
|
||||
arenas_tdata_bypass_cleanup
|
||||
arenas_tdata_cleanup
|
||||
atomic_add_p
|
||||
atomic_add_u
|
||||
@ -285,7 +284,6 @@ malloc_vsnprintf
|
||||
malloc_write
|
||||
mb_write
|
||||
narenas_auto
|
||||
narenas_tdata_cleanup
|
||||
narenas_total_get
|
||||
ncpus
|
||||
nhbins
|
||||
@ -410,7 +408,6 @@ rtree_elm_release
|
||||
rtree_elm_witness_access
|
||||
rtree_elm_witness_acquire
|
||||
rtree_elm_witness_release
|
||||
rtree_elm_witnesses_cleanup
|
||||
rtree_elm_write
|
||||
rtree_elm_write_acquired
|
||||
rtree_new
|
||||
@ -451,7 +448,6 @@ tcache_cleanup
|
||||
tcache_create
|
||||
tcache_dalloc_large
|
||||
tcache_dalloc_small
|
||||
tcache_enabled_cleanup
|
||||
tcache_enabled_get
|
||||
tcache_enabled_set
|
||||
tcache_event
|
||||
@ -467,8 +463,6 @@ tcaches_create
|
||||
tcaches_destroy
|
||||
tcaches_flush
|
||||
tcaches_get
|
||||
thread_allocated_cleanup
|
||||
thread_deallocated_cleanup
|
||||
ticker_copy
|
||||
ticker_init
|
||||
ticker_read
|
||||
@ -539,7 +533,6 @@ tsdn_tsd
|
||||
witness_assert_lockless
|
||||
witness_assert_not_owner
|
||||
witness_assert_owner
|
||||
witness_fork_cleanup
|
||||
witness_init
|
||||
witness_lock
|
||||
witness_lock_error
|
||||
|
@ -137,7 +137,6 @@ void rtree_elm_witness_access(tsdn_t *tsdn, const rtree_t *rtree,
|
||||
const rtree_elm_t *elm);
|
||||
void rtree_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
|
||||
const rtree_elm_t *elm);
|
||||
void rtree_elm_witnesses_cleanup(tsd_t *tsd);
|
||||
|
||||
#endif /* JEMALLOC_H_EXTERNS */
|
||||
/******************************************************************************/
|
||||
|
@ -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_create(tsdn_t *tsdn, arena_t *arena);
|
||||
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);
|
||||
bool tcaches_create(tsdn_t *tsdn, unsigned *r_ind);
|
||||
void tcaches_flush(tsd_t *tsd, unsigned ind);
|
||||
|
@ -561,20 +561,20 @@ struct tsd_init_head_s {
|
||||
#endif
|
||||
|
||||
#define MALLOC_TSD \
|
||||
/* O(name, type) */ \
|
||||
O(tcache, tcache_t *) \
|
||||
O(thread_allocated, uint64_t) \
|
||||
O(thread_deallocated, uint64_t) \
|
||||
O(prof_tdata, prof_tdata_t *) \
|
||||
O(iarena, arena_t *) \
|
||||
O(arena, arena_t *) \
|
||||
O(arenas_tdata, arena_tdata_t *) \
|
||||
O(narenas_tdata, unsigned) \
|
||||
O(arenas_tdata_bypass, bool) \
|
||||
O(tcache_enabled, tcache_enabled_t) \
|
||||
O(witnesses, witness_list_t) \
|
||||
O(rtree_elm_witnesses, rtree_elm_witness_tsd_t) \
|
||||
O(witness_fork, bool) \
|
||||
/* O(name, type, cleanup) */ \
|
||||
O(tcache, tcache_t *, yes) \
|
||||
O(thread_allocated, uint64_t, no) \
|
||||
O(thread_deallocated, uint64_t, no) \
|
||||
O(prof_tdata, prof_tdata_t *, yes) \
|
||||
O(iarena, arena_t *, yes) \
|
||||
O(arena, arena_t *, yes) \
|
||||
O(arenas_tdata, arena_tdata_t *, yes) \
|
||||
O(narenas_tdata, unsigned, no) \
|
||||
O(arenas_tdata_bypass, bool, no) \
|
||||
O(tcache_enabled, tcache_enabled_t, no) \
|
||||
O(witnesses, witness_list_t, yes) \
|
||||
O(rtree_elm_witnesses, rtree_elm_witness_tsd_t,no) \
|
||||
O(witness_fork, bool, no) \
|
||||
|
||||
#define TSD_INITIALIZER { \
|
||||
tsd_state_uninitialized, \
|
||||
@ -595,7 +595,7 @@ struct tsd_init_head_s {
|
||||
|
||||
struct tsd_s {
|
||||
tsd_state_t state;
|
||||
#define O(n, t) \
|
||||
#define O(n, t, c) \
|
||||
t n;
|
||||
MALLOC_TSD
|
||||
#undef O
|
||||
@ -642,7 +642,7 @@ malloc_tsd_protos(JEMALLOC_ATTR(unused), , tsd_t)
|
||||
tsd_t *tsd_fetch(void);
|
||||
tsdn_t *tsd_tsdn(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##_get(tsd_t *tsd); \
|
||||
void tsd_##n##_set(tsd_t *tsd, t n);
|
||||
@ -691,7 +691,7 @@ tsd_nominal(tsd_t *tsd)
|
||||
return (tsd->state == tsd_state_nominal);
|
||||
}
|
||||
|
||||
#define O(n, t) \
|
||||
#define O(n, t, c) \
|
||||
JEMALLOC_ALWAYS_INLINE t * \
|
||||
tsd_##n##p_get(tsd_t *tsd) \
|
||||
{ \
|
||||
|
@ -103,7 +103,6 @@ void witness_lockless_error(const witness_list_t *witnesses);
|
||||
#endif
|
||||
|
||||
void witnesses_cleanup(tsd_t *tsd);
|
||||
void witness_fork_cleanup(tsd_t *tsd);
|
||||
void witness_prefork(tsd_t *tsd);
|
||||
void witness_postfork_parent(tsd_t *tsd);
|
||||
void witness_postfork_child(tsd_t *tsd);
|
||||
|
@ -644,20 +644,6 @@ arena_choose_hard(tsd_t *tsd, bool internal)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void
|
||||
thread_allocated_cleanup(tsd_t *tsd)
|
||||
{
|
||||
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
void
|
||||
thread_deallocated_cleanup(tsd_t *tsd)
|
||||
{
|
||||
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
void
|
||||
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
|
||||
stats_print_atexit(void)
|
||||
{
|
||||
|
@ -285,10 +285,3 @@ rtree_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
|
||||
witness_unlock(tsdn, witness);
|
||||
rtree_elm_witness_dalloc(tsdn_tsd(tsdn), witness, elm);
|
||||
}
|
||||
|
||||
void
|
||||
rtree_elm_witnesses_cleanup(tsd_t *tsd)
|
||||
{
|
||||
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
@ -404,13 +404,6 @@ tcache_cleanup(tsd_t *tsd)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tcache_enabled_cleanup(tsd_t *tsd)
|
||||
{
|
||||
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
void
|
||||
tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
|
||||
{
|
||||
|
@ -77,9 +77,14 @@ tsd_cleanup(void *arg)
|
||||
/* Do nothing. */
|
||||
break;
|
||||
case tsd_state_nominal:
|
||||
#define O(n, t) \
|
||||
#define MALLOC_TSD_cleanup_yes(n, t) \
|
||||
n##_cleanup(tsd);
|
||||
#define MALLOC_TSD_cleanup_no(n, t)
|
||||
#define O(n, t, c) \
|
||||
MALLOC_TSD_cleanup_##c(n, t)
|
||||
MALLOC_TSD
|
||||
#undef MALLOC_TSD_cleanup_yes
|
||||
#undef MALLOC_TSD_cleanup_no
|
||||
#undef O
|
||||
tsd->state = tsd_state_purgatory;
|
||||
tsd_set(tsd);
|
||||
|
@ -103,13 +103,6 @@ witnesses_cleanup(tsd_t *tsd)
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
void
|
||||
witness_fork_cleanup(tsd_t *tsd)
|
||||
{
|
||||
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
void
|
||||
witness_prefork(tsd_t *tsd)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user