Split ctl handlers by mallctl namespace

Move mallctl handler implementations out of src/ctl.c into namespace-oriented ctl_* modules, while keeping the mallctl tree and dispatch machinery centralized in ctl.c.

Add shared ctl mallctl helper macros and thin ctl arena/stat interfaces needed by the split modules. Wire the new sources into Makefile.in and MSVC project files.

Keep behavior unchanged; this is intended as a readability and navigation refactor.
This commit is contained in:
Slobodan Predolac 2026-05-27 16:13:09 -07:00
parent 2004cf039e
commit ca77aca653
31 changed files with 4097 additions and 3760 deletions

View file

@ -115,7 +115,11 @@ bool ctl_boot(void);
void ctl_prefork(tsdn_t *tsdn);
void ctl_postfork_parent(tsdn_t *tsdn);
void ctl_postfork_child(tsdn_t *tsdn);
void ctl_mtx_lock(tsdn_t *tsdn);
void ctl_mtx_unlock(tsdn_t *tsdn);
void ctl_mtx_assert_held(tsdn_t *tsdn);
void ctl_mtx_prof_read(tsdn_t *tsdn, mutex_prof_data_t *mutex_prof_data);
void ctl_mtx_prof_data_reset(tsdn_t *tsdn);
#define xmallctl(name, oldp, oldlenp, newp, newlen) \
do { \

View file

@ -0,0 +1,54 @@
#ifndef JEMALLOC_INTERNAL_CTL_ARENA_H
#define JEMALLOC_INTERNAL_CTL_ARENA_H
#include "jemalloc/internal/ctl_mallctl.h"
#define CTL_ARENA_PROTO(n) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
CTL_ARENA_PROTO(arena_i_initialized)
CTL_ARENA_PROTO(arena_i_decay)
CTL_ARENA_PROTO(arena_i_purge)
CTL_ARENA_PROTO(arena_i_reset)
CTL_ARENA_PROTO(arena_i_destroy)
CTL_ARENA_PROTO(arena_i_dss)
CTL_ARENA_PROTO(arena_i_oversize_threshold)
CTL_ARENA_PROTO(arena_i_dirty_decay_ms)
CTL_ARENA_PROTO(arena_i_muzzy_decay_ms)
CTL_ARENA_PROTO(arena_i_extent_hooks)
CTL_ARENA_PROTO(arena_i_retain_grow_limit)
CTL_ARENA_PROTO(arena_i_name)
CTL_ARENA_PROTO(arenas_narenas)
CTL_ARENA_PROTO(arenas_dirty_decay_ms)
CTL_ARENA_PROTO(arenas_muzzy_decay_ms)
CTL_ARENA_PROTO(arenas_quantum)
CTL_ARENA_PROTO(arenas_page)
CTL_ARENA_PROTO(arenas_hugepage)
CTL_ARENA_PROTO(arenas_tcache_max)
CTL_ARENA_PROTO(arenas_nbins)
CTL_ARENA_PROTO(arenas_nhbins)
CTL_ARENA_PROTO(arenas_bin_i_size)
CTL_ARENA_PROTO(arenas_bin_i_nregs)
CTL_ARENA_PROTO(arenas_bin_i_slab_size)
CTL_ARENA_PROTO(arenas_bin_i_nshards)
CTL_ARENA_PROTO(arenas_nlextents)
CTL_ARENA_PROTO(arenas_lextent_i_size)
CTL_ARENA_PROTO(arenas_create)
CTL_ARENA_PROTO(arenas_lookup)
CTL_ARENA_PROTO(experimental_arenas_create_ext)
#undef CTL_ARENA_PROTO
bool ctl_arenas_init(tsd_t *tsd);
ctl_arena_t *ctl_arenas_refresh(tsdn_t *tsdn);
ctl_arena_t *ctl_arenas_i(size_t i);
uint64_t ctl_arenas_epoch_get(void);
void ctl_arenas_epoch_advance(void);
bool ctl_arena_i_indexable(tsdn_t *tsdn, size_t i);
bool ctl_arenas_i_verify(size_t i);
int ctl_arena_create(tsd_t *tsd, void *oldp, size_t *oldlenp,
const arena_config_t *config);
#endif /* JEMALLOC_INTERNAL_CTL_ARENA_H */

View file

@ -0,0 +1,11 @@
#ifndef JEMALLOC_INTERNAL_CTL_BACKGROUND_THREAD_H
#define JEMALLOC_INTERNAL_CTL_BACKGROUND_THREAD_H
#include "jemalloc/internal/ctl_mallctl.h"
int background_thread_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int max_background_threads_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
#endif /* JEMALLOC_INTERNAL_CTL_BACKGROUND_THREAD_H */

View file

@ -0,0 +1,33 @@
#ifndef JEMALLOC_INTERNAL_CTL_CONFIG_H
#define JEMALLOC_INTERNAL_CTL_CONFIG_H
#include "jemalloc/internal/ctl_mallctl.h"
int config_cache_oblivious_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_debug_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int config_fill_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int config_lazy_lock_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_malloc_conf_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_opt_safety_checks_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_prof_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int config_prof_libgcc_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_prof_libunwind_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_prof_frameptr_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int config_stats_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int config_utrace_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int config_xmalloc_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
#endif /* JEMALLOC_INTERNAL_CTL_CONFIG_H */

View file

@ -0,0 +1,170 @@
#ifndef JEMALLOC_INTERNAL_CTL_MALLCTL_H
#define JEMALLOC_INTERNAL_CTL_MALLCTL_H
#include "jemalloc/internal/ctl.h"
#define READONLY() \
do { \
if (newp != NULL || newlen != 0) { \
ret = EPERM; \
goto label_return; \
} \
} while (0)
#define WRITEONLY() \
do { \
if (oldp != NULL || oldlenp != NULL) { \
ret = EPERM; \
goto label_return; \
} \
} while (0)
/* Can read or write, but not both. */
#define READ_XOR_WRITE() \
do { \
if ((oldp != NULL && oldlenp != NULL) \
&& (newp != NULL || newlen != 0)) { \
ret = EPERM; \
goto label_return; \
} \
} while (0)
/* Can neither read nor write. */
#define NEITHER_READ_NOR_WRITE() \
do { \
if (oldp != NULL || oldlenp != NULL || newp != NULL \
|| newlen != 0) { \
ret = EPERM; \
goto label_return; \
} \
} while (0)
/* Verify that the space provided is enough. */
#define VERIFY_READ(t) \
do { \
if (oldp == NULL || oldlenp == NULL \
|| *oldlenp != sizeof(t)) { \
if (oldlenp != NULL) { \
*oldlenp = 0; \
} \
ret = EINVAL; \
goto label_return; \
} \
} while (0)
#define READ(v, t) \
do { \
if (oldp != NULL && oldlenp != NULL) { \
if (*oldlenp != sizeof(t)) { \
size_t copylen = (sizeof(t) <= *oldlenp) \
? sizeof(t) \
: *oldlenp; \
memcpy(oldp, (void *)&(v), copylen); \
*oldlenp = copylen; \
ret = EINVAL; \
goto label_return; \
} \
*(t *)oldp = (v); \
} \
} while (0)
#define WRITE(v, t) \
do { \
if (newp != NULL) { \
if (newlen != sizeof(t)) { \
ret = EINVAL; \
goto label_return; \
} \
(v) = *(t *)newp; \
} \
} while (0)
#define ASSURED_WRITE(v, t) \
do { \
if (newp == NULL || newlen != sizeof(t)) { \
ret = EINVAL; \
goto label_return; \
} \
(v) = *(t *)newp; \
} while (0)
#define MIB_UNSIGNED(v, i) \
do { \
if (mib[i] > UINT_MAX) { \
ret = EFAULT; \
goto label_return; \
} \
v = (unsigned)mib[i]; \
} while (0)
#define CTL_RO_NL_GEN_PUBLIC(n, v, t) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen) { \
int ret; \
t oldval; \
\
READONLY(); \
oldval = (v); \
READ(oldval, t); \
\
ret = 0; \
label_return: \
return ret; \
}
#define CTL_RO_GEN_PUBLIC(n, v, t) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen) { \
int ret; \
t oldval; \
\
READONLY(); \
ctl_mtx_lock(tsd_tsdn(tsd)); \
oldval = (v); \
READ(oldval, t); \
\
ret = 0; \
label_return: \
ctl_mtx_unlock(tsd_tsdn(tsd)); \
return ret; \
}
#define CTL_RO_NL_CGEN_PUBLIC(c, n, v, t) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen) { \
int ret; \
t oldval; \
\
if (!(c)) { \
return ENOENT; \
} \
READONLY(); \
oldval = (v); \
READ(oldval, t); \
\
ret = 0; \
label_return: \
return ret; \
}
#define CTL_RO_CGEN_PUBLIC(c, n, v, t) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen) { \
int ret; \
t oldval; \
\
if (!(c)) { \
return ENOENT; \
} \
READONLY(); \
ctl_mtx_lock(tsd_tsdn(tsd)); \
oldval = (v); \
READ(oldval, t); \
\
ret = 0; \
label_return: \
ctl_mtx_unlock(tsd_tsdn(tsd)); \
return ret; \
}
#endif /* JEMALLOC_INTERNAL_CTL_MALLCTL_H */

View file

@ -0,0 +1,93 @@
#ifndef JEMALLOC_INTERNAL_CTL_OPT_H
#define JEMALLOC_INTERNAL_CTL_OPT_H
#include "jemalloc/internal/ctl_mallctl.h"
#define CTL_OPT_PROTO(n) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
CTL_OPT_PROTO(opt_abort)
CTL_OPT_PROTO(opt_abort_conf)
CTL_OPT_PROTO(opt_cache_oblivious)
CTL_OPT_PROTO(opt_debug_double_free_max_scan)
CTL_OPT_PROTO(opt_trust_madvise)
CTL_OPT_PROTO(opt_experimental_hpa_start_huge_if_thp_always)
CTL_OPT_PROTO(opt_experimental_hpa_enforce_hugify)
CTL_OPT_PROTO(opt_confirm_conf)
CTL_OPT_PROTO(opt_hpa)
CTL_OPT_PROTO(opt_hpa_slab_max_alloc)
CTL_OPT_PROTO(opt_hpa_hugification_threshold)
CTL_OPT_PROTO(opt_hpa_hugify_delay_ms)
CTL_OPT_PROTO(opt_hpa_hugify_sync)
CTL_OPT_PROTO(opt_hpa_min_purge_interval_ms)
CTL_OPT_PROTO(opt_experimental_hpa_max_purge_nhp)
CTL_OPT_PROTO(opt_hpa_purge_threshold)
CTL_OPT_PROTO(opt_hpa_min_purge_delay_ms)
CTL_OPT_PROTO(opt_hpa_hugify_style)
CTL_OPT_PROTO(opt_hpa_dirty_mult)
CTL_OPT_PROTO(opt_hpa_sec_nshards)
CTL_OPT_PROTO(opt_hpa_sec_max_alloc)
CTL_OPT_PROTO(opt_hpa_sec_max_bytes)
CTL_OPT_PROTO(opt_huge_arena_pac_thp)
CTL_OPT_PROTO(opt_metadata_thp)
CTL_OPT_PROTO(opt_retain)
CTL_OPT_PROTO(opt_dss)
CTL_OPT_PROTO(opt_narenas)
CTL_OPT_PROTO(opt_percpu_arena)
CTL_OPT_PROTO(opt_oversize_threshold)
CTL_OPT_PROTO(opt_background_thread)
CTL_OPT_PROTO(opt_mutex_max_spin)
CTL_OPT_PROTO(opt_max_background_threads)
CTL_OPT_PROTO(opt_dirty_decay_ms)
CTL_OPT_PROTO(opt_muzzy_decay_ms)
CTL_OPT_PROTO(opt_stats_print)
CTL_OPT_PROTO(opt_stats_print_opts)
CTL_OPT_PROTO(opt_stats_interval)
CTL_OPT_PROTO(opt_stats_interval_opts)
CTL_OPT_PROTO(opt_junk)
CTL_OPT_PROTO(opt_zero)
CTL_OPT_PROTO(opt_utrace)
CTL_OPT_PROTO(opt_xmalloc)
CTL_OPT_PROTO(opt_experimental_infallible_new)
CTL_OPT_PROTO(opt_experimental_tcache_gc)
CTL_OPT_PROTO(opt_tcache)
CTL_OPT_PROTO(opt_tcache_max)
CTL_OPT_PROTO(opt_tcache_nslots_small_min)
CTL_OPT_PROTO(opt_tcache_nslots_small_max)
CTL_OPT_PROTO(opt_tcache_nslots_large)
CTL_OPT_PROTO(opt_lg_tcache_nslots_mul)
CTL_OPT_PROTO(opt_tcache_gc_incr_bytes)
CTL_OPT_PROTO(opt_tcache_gc_delay_bytes)
CTL_OPT_PROTO(opt_lg_tcache_flush_small_div)
CTL_OPT_PROTO(opt_lg_tcache_flush_large_div)
CTL_OPT_PROTO(opt_thp)
CTL_OPT_PROTO(opt_lg_extent_max_active_fit)
CTL_OPT_PROTO(opt_prof)
CTL_OPT_PROTO(opt_prof_prefix)
CTL_OPT_PROTO(opt_prof_active)
CTL_OPT_PROTO(opt_prof_thread_active_init)
CTL_OPT_PROTO(opt_prof_bt_max)
CTL_OPT_PROTO(opt_lg_prof_sample)
CTL_OPT_PROTO(opt_lg_prof_interval)
CTL_OPT_PROTO(opt_prof_gdump)
CTL_OPT_PROTO(opt_prof_final)
CTL_OPT_PROTO(opt_prof_leak)
CTL_OPT_PROTO(opt_prof_leak_error)
CTL_OPT_PROTO(opt_prof_accum)
CTL_OPT_PROTO(opt_prof_pid_namespace)
CTL_OPT_PROTO(opt_prof_recent_alloc_max)
CTL_OPT_PROTO(opt_prof_stats)
CTL_OPT_PROTO(opt_prof_sys_thread_name)
CTL_OPT_PROTO(opt_prof_time_res)
CTL_OPT_PROTO(opt_lg_san_uaf_align)
CTL_OPT_PROTO(opt_zero_realloc)
CTL_OPT_PROTO(opt_disable_large_size_classes)
CTL_OPT_PROTO(opt_process_madvise_max_batch)
CTL_OPT_PROTO(opt_malloc_conf_symlink)
CTL_OPT_PROTO(opt_malloc_conf_env_var)
CTL_OPT_PROTO(opt_malloc_conf_global_var)
#undef CTL_OPT_PROTO
#endif /* JEMALLOC_INTERNAL_CTL_OPT_H */

View file

@ -0,0 +1,33 @@
#ifndef JEMALLOC_INTERNAL_CTL_PROF_H
#define JEMALLOC_INTERNAL_CTL_PROF_H
#include "jemalloc/internal/ctl_mallctl.h"
#define CTL_PROF_PROTO(n) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
CTL_PROF_PROTO(prof_thread_active_init)
CTL_PROF_PROTO(prof_active)
CTL_PROF_PROTO(prof_dump)
CTL_PROF_PROTO(prof_gdump)
CTL_PROF_PROTO(prof_prefix)
CTL_PROF_PROTO(prof_reset)
CTL_PROF_PROTO(prof_interval)
CTL_PROF_PROTO(lg_prof_sample)
CTL_PROF_PROTO(prof_log_start)
CTL_PROF_PROTO(prof_log_stop)
CTL_PROF_PROTO(prof_stats_bins_i_live)
CTL_PROF_PROTO(prof_stats_bins_i_accum)
CTL_PROF_PROTO(prof_stats_lextents_i_live)
CTL_PROF_PROTO(prof_stats_lextents_i_accum)
CTL_PROF_PROTO(experimental_hooks_prof_backtrace)
CTL_PROF_PROTO(experimental_hooks_prof_dump)
CTL_PROF_PROTO(experimental_hooks_prof_sample)
CTL_PROF_PROTO(experimental_hooks_prof_sample_free)
CTL_PROF_PROTO(experimental_prof_recent_alloc_max)
CTL_PROF_PROTO(experimental_prof_recent_alloc_dump)
#undef CTL_PROF_PROTO
#endif /* JEMALLOC_INTERNAL_CTL_PROF_H */

View file

@ -0,0 +1,179 @@
#ifndef JEMALLOC_INTERNAL_CTL_STATS_H
#define JEMALLOC_INTERNAL_CTL_STATS_H
#include "jemalloc/internal/ctl_mallctl.h"
#define CTL_STATS_PROTO(n) \
int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
CTL_STATS_PROTO(stats_arenas_i_small_allocated)
CTL_STATS_PROTO(stats_arenas_i_small_nmalloc)
CTL_STATS_PROTO(stats_arenas_i_small_ndalloc)
CTL_STATS_PROTO(stats_arenas_i_small_nrequests)
CTL_STATS_PROTO(stats_arenas_i_small_nfills)
CTL_STATS_PROTO(stats_arenas_i_small_nflushes)
CTL_STATS_PROTO(stats_arenas_i_large_allocated)
CTL_STATS_PROTO(stats_arenas_i_large_nmalloc)
CTL_STATS_PROTO(stats_arenas_i_large_ndalloc)
CTL_STATS_PROTO(stats_arenas_i_large_nrequests)
CTL_STATS_PROTO(stats_arenas_i_large_nfills)
CTL_STATS_PROTO(stats_arenas_i_large_nflushes)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nmalloc)
CTL_STATS_PROTO(stats_arenas_i_bins_j_ndalloc)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nrequests)
CTL_STATS_PROTO(stats_arenas_i_bins_j_curregs)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nfills)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nflushes)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nslabs)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nreslabs)
CTL_STATS_PROTO(stats_arenas_i_bins_j_curslabs)
CTL_STATS_PROTO(stats_arenas_i_bins_j_nonfull_slabs)
CTL_STATS_PROTO(stats_arenas_i_lextents_j_nmalloc)
CTL_STATS_PROTO(stats_arenas_i_lextents_j_ndalloc)
CTL_STATS_PROTO(stats_arenas_i_lextents_j_nrequests)
CTL_STATS_PROTO(stats_arenas_i_lextents_j_curlextents)
CTL_STATS_PROTO(stats_arenas_i_extents_j_ndirty)
CTL_STATS_PROTO(stats_arenas_i_extents_j_nmuzzy)
CTL_STATS_PROTO(stats_arenas_i_extents_j_nretained)
CTL_STATS_PROTO(stats_arenas_i_extents_j_npinned)
CTL_STATS_PROTO(stats_arenas_i_extents_j_dirty_bytes)
CTL_STATS_PROTO(stats_arenas_i_extents_j_muzzy_bytes)
CTL_STATS_PROTO(stats_arenas_i_extents_j_retained_bytes)
CTL_STATS_PROTO(stats_arenas_i_extents_j_pinned_bytes)
/* Merged set of stats for HPA shard. */
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_npageslabs)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nactive)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_ndirty)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_npurge_passes)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_npurges)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nhugifies)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nhugify_failures)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_ndehugifies)
/* Set of stats for non-hugified and hugified slabs. */
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_npageslabs_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_npageslabs_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_nactive_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_nactive_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_ndirty_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_slabs_ndirty_huge)
/* A parallel set of stats for full slabs. */
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_npageslabs_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_npageslabs_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_nactive_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_nactive_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_ndirty_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_full_slabs_ndirty_huge)
/* A parallel set for the empty slabs. */
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_npageslabs_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_npageslabs_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_nactive_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_nactive_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_ndirty_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_empty_slabs_ndirty_huge)
/*
* And one for the slabs that are neither empty nor full, but indexed by how
* full they are.
*/
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_ndirty_nonhuge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_ndirty_huge)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_min_extents)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_max_extents)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_extents)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_ps)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_pages_per_ps)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_extents_per_ps)
CTL_STATS_PROTO(stats_arenas_i_hpa_shard_alloc_j_total_elapsed_ns_per_ps)
CTL_STATS_PROTO(stats_arenas_i_nthreads)
CTL_STATS_PROTO(stats_arenas_i_uptime)
CTL_STATS_PROTO(stats_arenas_i_dss)
CTL_STATS_PROTO(stats_arenas_i_dirty_decay_ms)
CTL_STATS_PROTO(stats_arenas_i_muzzy_decay_ms)
CTL_STATS_PROTO(stats_arenas_i_pactive)
CTL_STATS_PROTO(stats_arenas_i_pdirty)
CTL_STATS_PROTO(stats_arenas_i_pmuzzy)
CTL_STATS_PROTO(stats_arenas_i_mapped)
CTL_STATS_PROTO(stats_arenas_i_retained)
CTL_STATS_PROTO(stats_arenas_i_pinned)
CTL_STATS_PROTO(stats_arenas_i_extent_avail)
CTL_STATS_PROTO(stats_arenas_i_dirty_npurge)
CTL_STATS_PROTO(stats_arenas_i_dirty_nmadvise)
CTL_STATS_PROTO(stats_arenas_i_dirty_purged)
CTL_STATS_PROTO(stats_arenas_i_muzzy_npurge)
CTL_STATS_PROTO(stats_arenas_i_muzzy_nmadvise)
CTL_STATS_PROTO(stats_arenas_i_muzzy_purged)
CTL_STATS_PROTO(stats_arenas_i_base)
CTL_STATS_PROTO(stats_arenas_i_internal)
CTL_STATS_PROTO(stats_arenas_i_metadata_edata)
CTL_STATS_PROTO(stats_arenas_i_metadata_rtree)
CTL_STATS_PROTO(stats_arenas_i_metadata_thp)
CTL_STATS_PROTO(stats_arenas_i_tcache_bytes)
CTL_STATS_PROTO(stats_arenas_i_tcache_stashed_bytes)
CTL_STATS_PROTO(stats_arenas_i_resident)
CTL_STATS_PROTO(stats_arenas_i_abandoned_vm)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_bytes)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_hits)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_misses)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_dalloc_flush)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_dalloc_noflush)
CTL_STATS_PROTO(stats_arenas_i_hpa_sec_overfills)
CTL_STATS_PROTO(stats_allocated)
CTL_STATS_PROTO(stats_active)
CTL_STATS_PROTO(stats_background_thread_num_threads)
CTL_STATS_PROTO(stats_background_thread_num_runs)
CTL_STATS_PROTO(stats_background_thread_run_interval)
CTL_STATS_PROTO(stats_metadata)
CTL_STATS_PROTO(stats_metadata_edata)
CTL_STATS_PROTO(stats_metadata_rtree)
CTL_STATS_PROTO(stats_metadata_thp)
CTL_STATS_PROTO(stats_resident)
CTL_STATS_PROTO(stats_mapped)
CTL_STATS_PROTO(stats_retained)
CTL_STATS_PROTO(stats_pinned)
CTL_STATS_PROTO(stats_zero_reallocs)
CTL_STATS_PROTO(approximate_stats_active)
#define MUTEX_STATS_CTL_PROTO_GEN(n) \
CTL_STATS_PROTO(stats_##n##_num_ops) \
CTL_STATS_PROTO(stats_##n##_num_wait) \
CTL_STATS_PROTO(stats_##n##_num_spin_acq) \
CTL_STATS_PROTO(stats_##n##_num_owner_switch) \
CTL_STATS_PROTO(stats_##n##_total_wait_time) \
CTL_STATS_PROTO(stats_##n##_max_wait_time) \
CTL_STATS_PROTO(stats_##n##_max_num_thds)
/* Global mutexes. */
#define OP(mtx) MUTEX_STATS_CTL_PROTO_GEN(mutexes_##mtx)
MUTEX_PROF_GLOBAL_MUTEXES
#undef OP
/* Per arena mutexes. */
#define OP(mtx) MUTEX_STATS_CTL_PROTO_GEN(arenas_i_mutexes_##mtx)
MUTEX_PROF_ARENA_MUTEXES
#undef OP
/* Arena bin mutexes. */
MUTEX_STATS_CTL_PROTO_GEN(arenas_i_bins_j_mutex)
#undef MUTEX_STATS_CTL_PROTO_GEN
CTL_STATS_PROTO(stats_mutexes_reset)
#undef CTL_STATS_PROTO
bool ctl_stats_init(tsdn_t *tsdn);
void ctl_stats_refresh(tsdn_t *tsdn, ctl_arena_t *ctl_sarena);
#endif /* JEMALLOC_INTERNAL_CTL_STATS_H */

View file

@ -0,0 +1,13 @@
#ifndef JEMALLOC_INTERNAL_CTL_TCACHE_H
#define JEMALLOC_INTERNAL_CTL_TCACHE_H
#include "jemalloc/internal/ctl_mallctl.h"
int tcache_create_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int tcache_flush_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int tcache_destroy_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
#endif /* JEMALLOC_INTERNAL_CTL_TCACHE_H */

View file

@ -0,0 +1,39 @@
#ifndef JEMALLOC_INTERNAL_CTL_THREAD_H
#define JEMALLOC_INTERNAL_CTL_THREAD_H
#include "jemalloc/internal/ctl_mallctl.h"
int thread_tcache_enabled_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_tcache_max_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_tcache_flush_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_tcache_ncached_max_write_ctl(tsd_t *tsd, const size_t *mib,
size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_tcache_ncached_max_read_sizeclass_ctl(tsd_t *tsd, const size_t *mib,
size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_peak_read_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_peak_reset_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_prof_name_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_prof_active_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_arena_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int thread_allocated_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_allocatedp_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_deallocated_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_deallocatedp_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
int thread_idle_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
int experimental_hooks_thread_event_ctl(tsd_t *tsd, const size_t *mib,
size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
#endif /* JEMALLOC_INTERNAL_CTL_THREAD_H */

View file

@ -0,0 +1,9 @@
#ifndef JEMALLOC_INTERNAL_CTL_UTILIZATION_H
#define JEMALLOC_INTERNAL_CTL_UTILIZATION_H
#include "jemalloc/internal/ctl_mallctl.h"
int experimental_utilization_batch_query_ctl(tsd_t *tsd, const size_t *mib,
size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
#endif /* JEMALLOC_INTERNAL_CTL_UTILIZATION_H */

View file

@ -12,7 +12,7 @@
/*
* The following struct is for experimental purposes. See
* experimental_utilization_batch_query_ctl in src/ctl.c.
* experimental_utilization_batch_query_ctl in src/ctl_utilization.c.
*/
typedef struct inspect_extent_util_stats_s inspect_extent_util_stats_t;
struct inspect_extent_util_stats_s {