Differential D24522 Diff 70932 head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h
Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h
Show All 9 Lines | |||||
background_thread_enabled_set(tsdn_t *tsdn, bool state) { | background_thread_enabled_set(tsdn_t *tsdn, bool state) { | ||||
malloc_mutex_assert_owner(tsdn, &background_thread_lock); | malloc_mutex_assert_owner(tsdn, &background_thread_lock); | ||||
atomic_store_b(&background_thread_enabled_state, state, ATOMIC_RELAXED); | atomic_store_b(&background_thread_enabled_state, state, ATOMIC_RELAXED); | ||||
} | } | ||||
JEMALLOC_ALWAYS_INLINE background_thread_info_t * | JEMALLOC_ALWAYS_INLINE background_thread_info_t * | ||||
arena_background_thread_info_get(arena_t *arena) { | arena_background_thread_info_get(arena_t *arena) { | ||||
unsigned arena_ind = arena_ind_get(arena); | unsigned arena_ind = arena_ind_get(arena); | ||||
return &background_thread_info[arena_ind % ncpus]; | return &background_thread_info[arena_ind % max_background_threads]; | ||||
} | |||||
JEMALLOC_ALWAYS_INLINE background_thread_info_t * | |||||
background_thread_info_get(size_t ind) { | |||||
return &background_thread_info[ind % max_background_threads]; | |||||
} | } | ||||
JEMALLOC_ALWAYS_INLINE uint64_t | JEMALLOC_ALWAYS_INLINE uint64_t | ||||
background_thread_wakeup_time_get(background_thread_info_t *info) { | background_thread_wakeup_time_get(background_thread_info_t *info) { | ||||
uint64_t next_wakeup = nstime_ns(&info->next_wakeup); | uint64_t next_wakeup = nstime_ns(&info->next_wakeup); | ||||
assert(atomic_load_b(&info->indefinite_sleep, ATOMIC_ACQUIRE) == | assert(atomic_load_b(&info->indefinite_sleep, ATOMIC_ACQUIRE) == | ||||
(next_wakeup == BACKGROUND_THREAD_INDEFINITE_SLEEP)); | (next_wakeup == BACKGROUND_THREAD_INDEFINITE_SLEEP)); | ||||
return next_wakeup; | return next_wakeup; | ||||
Show All 31 Lines |