From e3db480f6f3c147a8630c0ec45fde1da5764270b Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 24 Jan 2019 16:15:04 -0800 Subject: [PATCH] Rename huge_threshold to oversize_threshold. The keyword huge tend to remind people of huge pages which is not relevent to the feature. --- doc/jemalloc.xml.in | 4 +--- include/jemalloc/internal/arena_externs.h | 4 ++-- include/jemalloc/internal/arena_inlines_b.h | 2 +- include/jemalloc/internal/arena_types.h | 6 +++--- src/arena.c | 14 +++++++------- src/ctl.c | 6 +++--- src/jemalloc.c | 6 +++--- src/stats.c | 2 +- test/unit/huge.c | 2 +- test/unit/mallctl.c | 4 ++-- 10 files changed, 24 insertions(+), 26 deletions(-) diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in index a73f0ad7..fe322e1d 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -1059,9 +1059,7 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", linkend="arena.i.dirty_decay_ms">arena.<i>.dirty_decay_ms for related dynamic control options. See opt.muzzy_decay_ms - for a description of muzzy pages. Note that when the huge_threshold - feature is enabled, the special auto arenas may use its own decay - settings. + for a description of muzzy pages. diff --git a/include/jemalloc/internal/arena_externs.h b/include/jemalloc/internal/arena_externs.h index bcc016e8..2bdddb77 100644 --- a/include/jemalloc/internal/arena_externs.h +++ b/include/jemalloc/internal/arena_externs.h @@ -16,8 +16,8 @@ extern const char *percpu_arena_mode_names[]; extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS]; extern malloc_mutex_t arenas_lock; -extern size_t opt_huge_threshold; -extern size_t huge_threshold; +extern size_t opt_oversize_threshold; +extern size_t oversize_threshold; void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, diff --git a/include/jemalloc/internal/arena_inlines_b.h b/include/jemalloc/internal/arena_inlines_b.h index c7d35b74..b7cdcea0 100644 --- a/include/jemalloc/internal/arena_inlines_b.h +++ b/include/jemalloc/internal/arena_inlines_b.h @@ -24,7 +24,7 @@ arena_choose_maybe_huge(tsd_t *tsd, arena_t *arena, size_t size) { * 1) is using auto arena selection (i.e. arena == NULL), and 2) the * thread is not assigned to a manual arena. */ - if (unlikely(size >= huge_threshold)) { + if (unlikely(size >= oversize_threshold)) { arena_t *tsd_arena = tsd_arena_get(tsd); if (tsd_arena == NULL || arena_is_auto(tsd_arena)) { return arena_choose_huge(tsd); diff --git a/include/jemalloc/internal/arena_types.h b/include/jemalloc/internal/arena_types.h index cf07cc02..8917ea3a 100644 --- a/include/jemalloc/internal/arena_types.h +++ b/include/jemalloc/internal/arena_types.h @@ -43,9 +43,9 @@ typedef enum { #define PERCPU_ARENA_DEFAULT percpu_arena_disabled /* - * When allocation_size >= huge_threshold, use the dedicated huge arena (unless - * have explicitly spicified arena index). 0 disables the feature. + * When allocation_size >= oversize_threshold, use the dedicated huge arena + * (unless have explicitly spicified arena index). 0 disables the feature. */ -#define HUGE_THRESHOLD_DEFAULT (8 << 20) +#define OVERSIZE_THRESHOLD_DEFAULT (8 << 20) #endif /* JEMALLOC_INTERNAL_ARENA_TYPES_H */ diff --git a/src/arena.c b/src/arena.c index 552a0f3b..60eac232 100644 --- a/src/arena.c +++ b/src/arena.c @@ -43,8 +43,8 @@ const uint64_t h_steps[SMOOTHSTEP_NSTEPS] = { static div_info_t arena_binind_div_info[SC_NBINS]; -size_t opt_huge_threshold = HUGE_THRESHOLD_DEFAULT; -size_t huge_threshold = HUGE_THRESHOLD_DEFAULT; +size_t opt_oversize_threshold = OVERSIZE_THRESHOLD_DEFAULT; +size_t oversize_threshold = OVERSIZE_THRESHOLD_DEFAULT; static unsigned huge_arena_ind; /******************************************************************************/ @@ -2112,15 +2112,15 @@ arena_init_huge(void) { bool huge_enabled; /* The threshold should be large size class. */ - if (opt_huge_threshold > SC_LARGE_MAXCLASS || - opt_huge_threshold < SC_LARGE_MINCLASS) { - opt_huge_threshold = 0; - huge_threshold = SC_LARGE_MAXCLASS + PAGE; + if (opt_oversize_threshold > SC_LARGE_MAXCLASS || + opt_oversize_threshold < SC_LARGE_MINCLASS) { + opt_oversize_threshold = 0; + oversize_threshold = SC_LARGE_MAXCLASS + PAGE; huge_enabled = false; } else { /* Reserve the index for the huge arena. */ huge_arena_ind = narenas_total_get(); - huge_threshold = opt_huge_threshold; + oversize_threshold = opt_oversize_threshold; huge_enabled = true; } diff --git a/src/ctl.c b/src/ctl.c index 0ec92249..09310a9d 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -85,7 +85,7 @@ CTL_PROTO(opt_retain) CTL_PROTO(opt_dss) CTL_PROTO(opt_narenas) CTL_PROTO(opt_percpu_arena) -CTL_PROTO(opt_huge_threshold) +CTL_PROTO(opt_oversize_threshold) CTL_PROTO(opt_background_thread) CTL_PROTO(opt_max_background_threads) CTL_PROTO(opt_dirty_decay_ms) @@ -300,7 +300,7 @@ static const ctl_named_node_t opt_node[] = { {NAME("dss"), CTL(opt_dss)}, {NAME("narenas"), CTL(opt_narenas)}, {NAME("percpu_arena"), CTL(opt_percpu_arena)}, - {NAME("huge_threshold"), CTL(opt_huge_threshold)}, + {NAME("oversize_threshold"), CTL(opt_oversize_threshold)}, {NAME("background_thread"), CTL(opt_background_thread)}, {NAME("max_background_threads"), CTL(opt_max_background_threads)}, {NAME("dirty_decay_ms"), CTL(opt_dirty_decay_ms)}, @@ -1716,7 +1716,7 @@ CTL_RO_NL_GEN(opt_dss, opt_dss, const char *) CTL_RO_NL_GEN(opt_narenas, opt_narenas, unsigned) CTL_RO_NL_GEN(opt_percpu_arena, percpu_arena_mode_names[opt_percpu_arena], const char *) -CTL_RO_NL_GEN(opt_huge_threshold, opt_huge_threshold, size_t) +CTL_RO_NL_GEN(opt_oversize_threshold, opt_oversize_threshold, size_t) CTL_RO_NL_GEN(opt_background_thread, opt_background_thread, bool) CTL_RO_NL_GEN(opt_max_background_threads, opt_max_background_threads, size_t) CTL_RO_NL_GEN(opt_dirty_decay_ms, opt_dirty_decay_ms, ssize_t) diff --git a/src/jemalloc.c b/src/jemalloc.c index 6bfc6133..855a98b4 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1240,15 +1240,15 @@ malloc_conf_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) { -1, (sizeof(size_t) << 3) - 1) /* - * The runtime option of huge_threshold remains + * The runtime option of oversize_threshold remains * undocumented. It may be tweaked in the next major * release (6.0). The default value 8M is rather * conservative / safe. Tuning it further down may * improve fragmentation a bit more, but may also cause * contention on the huge arena. */ - CONF_HANDLE_SIZE_T(opt_huge_threshold, - "huge_threshold", SC_LARGE_MINCLASS, + CONF_HANDLE_SIZE_T(opt_oversize_threshold, + "oversize_threshold", SC_LARGE_MINCLASS, SC_LARGE_MAXCLASS, yes, yes, false) CONF_HANDLE_SIZE_T(opt_lg_extent_max_active_fit, "lg_extent_max_active_fit", 0, diff --git a/src/stats.c b/src/stats.c index 75ccf3b8..eb210758 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1028,7 +1028,7 @@ stats_general_print(emitter_t *emitter) { OPT_WRITE_CHAR_P("dss") OPT_WRITE_UNSIGNED("narenas") OPT_WRITE_CHAR_P("percpu_arena") - OPT_WRITE_SIZE_T("huge_threshold") + OPT_WRITE_SIZE_T("oversize_threshold") OPT_WRITE_CHAR_P("metadata_thp") OPT_WRITE_BOOL_MUTABLE("background_thread", "background_thread") OPT_WRITE_SSIZE_T_MUTABLE("dirty_decay_ms", "arenas.dirty_decay_ms") diff --git a/test/unit/huge.c b/test/unit/huge.c index 7e54d076..ab72cf00 100644 --- a/test/unit/huge.c +++ b/test/unit/huge.c @@ -1,7 +1,7 @@ #include "test/jemalloc_test.h" /* Threshold: 2 << 20 = 2097152. */ -const char *malloc_conf = "huge_threshold:2097152"; +const char *malloc_conf = "oversize_threshold:2097152"; #define HUGE_SZ (2 << 20) #define SMALL_SZ (8) diff --git a/test/unit/mallctl.c b/test/unit/mallctl.c index b8b93405..498f9e06 100644 --- a/test/unit/mallctl.c +++ b/test/unit/mallctl.c @@ -164,7 +164,7 @@ TEST_BEGIN(test_mallctl_opt) { TEST_MALLCTL_OPT(const char *, dss, always); TEST_MALLCTL_OPT(unsigned, narenas, always); TEST_MALLCTL_OPT(const char *, percpu_arena, always); - TEST_MALLCTL_OPT(size_t, huge_threshold, always); + TEST_MALLCTL_OPT(size_t, oversize_threshold, always); TEST_MALLCTL_OPT(bool, background_thread, always); TEST_MALLCTL_OPT(ssize_t, dirty_decay_ms, always); TEST_MALLCTL_OPT(ssize_t, muzzy_decay_ms, always); @@ -342,7 +342,7 @@ TEST_BEGIN(test_thread_arena) { sz = sizeof(unsigned); assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0), 0, "Unexpected mallctl() failure"); - if (opt_huge_threshold != 0) { + if (opt_oversize_threshold != 0) { narenas--; } assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");