From 6de77799de0d8a705c595aa11f9dc70f147501ad Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Tue, 24 Mar 2020 08:31:34 -0700 Subject: [PATCH] Move thread event wait time update to local --- include/jemalloc/internal/thread_event.h | 24 ----------------------- src/thread_event.c | 25 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/include/jemalloc/internal/thread_event.h b/include/jemalloc/internal/thread_event.h index 229136b6..60fbfcba 100644 --- a/include/jemalloc/internal/thread_event.h +++ b/include/jemalloc/internal/thread_event.h @@ -33,7 +33,6 @@ typedef struct te_ctx_s { void te_assert_invariants_debug(tsd_t *tsd); void te_event_trigger(tsd_t *tsd, te_ctx_t *ctx, bool delay_event); -void te_event_update(tsd_t *tsd, bool alloc_event); void te_recompute_fast_threshold(tsd_t *tsd); void tsd_te_init(tsd_t *tsd); @@ -251,27 +250,4 @@ thread_alloc_event(tsd_t *tsd, size_t usize) { te_event_advance(tsd, usize, true); } -#define E(event, condition, is_alloc) \ -JEMALLOC_ALWAYS_INLINE void \ -te_##event##_event_update(tsd_t *tsd, uint64_t event_wait) { \ - te_assert_invariants(tsd); \ - assert(condition); \ - assert(tsd_nominal(tsd)); \ - assert(tsd_reentrancy_level_get(tsd) == 0); \ - assert(event_wait > 0U); \ - if (TE_MIN_START_WAIT > 1U && \ - unlikely(event_wait < TE_MIN_START_WAIT)) { \ - event_wait = TE_MIN_START_WAIT; \ - } \ - if (TE_MAX_START_WAIT < UINT64_MAX && \ - unlikely(event_wait > TE_MAX_START_WAIT)) { \ - event_wait = TE_MAX_START_WAIT; \ - } \ - event##_event_wait_set(tsd, event_wait); \ - te_event_update(tsd, is_alloc); \ -} - -ITERATE_OVER_ALL_EVENTS -#undef E - #endif /* JEMALLOC_INTERNAL_THREAD_EVENT_H */ diff --git a/src/thread_event.c b/src/thread_event.c index 99467ee3..8f718ddc 100644 --- a/src/thread_event.c +++ b/src/thread_event.c @@ -4,6 +4,31 @@ #include "jemalloc/internal/thread_event.h" +static void te_event_update(tsd_t *tsd, bool alloc_event); + +#define E(event, condition, is_alloc) \ +static void \ +te_##event##_event_update(tsd_t *tsd, uint64_t event_wait) { \ + te_assert_invariants(tsd); \ + assert(condition); \ + assert(tsd_nominal(tsd)); \ + assert(tsd_reentrancy_level_get(tsd) == 0); \ + assert(event_wait > 0U); \ + if (TE_MIN_START_WAIT > 1U && \ + unlikely(event_wait < TE_MIN_START_WAIT)) { \ + event_wait = TE_MIN_START_WAIT; \ + } \ + if (TE_MAX_START_WAIT < UINT64_MAX && \ + unlikely(event_wait > TE_MAX_START_WAIT)) { \ + event_wait = TE_MAX_START_WAIT; \ + } \ + event##_event_wait_set(tsd, event_wait); \ + te_event_update(tsd, is_alloc); \ +} + +ITERATE_OVER_ALL_EVENTS +#undef E + /* * Signatures for functions computing new event wait time. The functions * should be defined by the modules owning each event. The signatures here are