Rename huge_threshold to oversize_threshold.

The keyword huge tend to remind people of huge pages which is not relevent to
the feature.
This commit is contained in:
Qi Wang 2019-01-24 16:15:04 -08:00 committed by Qi Wang
parent 350809dc5d
commit e3db480f6f
10 changed files with 24 additions and 26 deletions

View File

@ -1059,9 +1059,7 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
linkend="arena.i.dirty_decay_ms"><mallctl>arena.&lt;i&gt;.dirty_decay_ms</mallctl></link> linkend="arena.i.dirty_decay_ms"><mallctl>arena.&lt;i&gt;.dirty_decay_ms</mallctl></link>
for related dynamic control options. See <link for related dynamic control options. See <link
linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link> linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
for a description of muzzy pages. Note that when the huge_threshold for a description of muzzy pages.</para></listitem>
feature is enabled, the special auto arenas may use its own decay
settings.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.muzzy_decay_ms"> <varlistentry id="opt.muzzy_decay_ms">

View File

@ -16,8 +16,8 @@ extern const char *percpu_arena_mode_names[];
extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS]; extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS];
extern malloc_mutex_t arenas_lock; extern malloc_mutex_t arenas_lock;
extern size_t opt_huge_threshold; extern size_t opt_oversize_threshold;
extern size_t huge_threshold; extern size_t oversize_threshold;
void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena,
unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms,

View File

@ -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 * 1) is using auto arena selection (i.e. arena == NULL), and 2) the
* thread is not assigned to a manual arena. * 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); arena_t *tsd_arena = tsd_arena_get(tsd);
if (tsd_arena == NULL || arena_is_auto(tsd_arena)) { if (tsd_arena == NULL || arena_is_auto(tsd_arena)) {
return arena_choose_huge(tsd); return arena_choose_huge(tsd);

View File

@ -43,9 +43,9 @@ typedef enum {
#define PERCPU_ARENA_DEFAULT percpu_arena_disabled #define PERCPU_ARENA_DEFAULT percpu_arena_disabled
/* /*
* When allocation_size >= huge_threshold, use the dedicated huge arena (unless * When allocation_size >= oversize_threshold, use the dedicated huge arena
* have explicitly spicified arena index). 0 disables the feature. * (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 */ #endif /* JEMALLOC_INTERNAL_ARENA_TYPES_H */

View File

@ -43,8 +43,8 @@ const uint64_t h_steps[SMOOTHSTEP_NSTEPS] = {
static div_info_t arena_binind_div_info[SC_NBINS]; static div_info_t arena_binind_div_info[SC_NBINS];
size_t opt_huge_threshold = HUGE_THRESHOLD_DEFAULT; size_t opt_oversize_threshold = OVERSIZE_THRESHOLD_DEFAULT;
size_t huge_threshold = HUGE_THRESHOLD_DEFAULT; size_t oversize_threshold = OVERSIZE_THRESHOLD_DEFAULT;
static unsigned huge_arena_ind; static unsigned huge_arena_ind;
/******************************************************************************/ /******************************************************************************/
@ -2112,15 +2112,15 @@ arena_init_huge(void) {
bool huge_enabled; bool huge_enabled;
/* The threshold should be large size class. */ /* The threshold should be large size class. */
if (opt_huge_threshold > SC_LARGE_MAXCLASS || if (opt_oversize_threshold > SC_LARGE_MAXCLASS ||
opt_huge_threshold < SC_LARGE_MINCLASS) { opt_oversize_threshold < SC_LARGE_MINCLASS) {
opt_huge_threshold = 0; opt_oversize_threshold = 0;
huge_threshold = SC_LARGE_MAXCLASS + PAGE; oversize_threshold = SC_LARGE_MAXCLASS + PAGE;
huge_enabled = false; huge_enabled = false;
} else { } else {
/* Reserve the index for the huge arena. */ /* Reserve the index for the huge arena. */
huge_arena_ind = narenas_total_get(); huge_arena_ind = narenas_total_get();
huge_threshold = opt_huge_threshold; oversize_threshold = opt_oversize_threshold;
huge_enabled = true; huge_enabled = true;
} }

View File

@ -85,7 +85,7 @@ CTL_PROTO(opt_retain)
CTL_PROTO(opt_dss) CTL_PROTO(opt_dss)
CTL_PROTO(opt_narenas) CTL_PROTO(opt_narenas)
CTL_PROTO(opt_percpu_arena) CTL_PROTO(opt_percpu_arena)
CTL_PROTO(opt_huge_threshold) CTL_PROTO(opt_oversize_threshold)
CTL_PROTO(opt_background_thread) CTL_PROTO(opt_background_thread)
CTL_PROTO(opt_max_background_threads) CTL_PROTO(opt_max_background_threads)
CTL_PROTO(opt_dirty_decay_ms) CTL_PROTO(opt_dirty_decay_ms)
@ -300,7 +300,7 @@ static const ctl_named_node_t opt_node[] = {
{NAME("dss"), CTL(opt_dss)}, {NAME("dss"), CTL(opt_dss)},
{NAME("narenas"), CTL(opt_narenas)}, {NAME("narenas"), CTL(opt_narenas)},
{NAME("percpu_arena"), CTL(opt_percpu_arena)}, {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("background_thread"), CTL(opt_background_thread)},
{NAME("max_background_threads"), CTL(opt_max_background_threads)}, {NAME("max_background_threads"), CTL(opt_max_background_threads)},
{NAME("dirty_decay_ms"), CTL(opt_dirty_decay_ms)}, {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_narenas, opt_narenas, unsigned)
CTL_RO_NL_GEN(opt_percpu_arena, percpu_arena_mode_names[opt_percpu_arena], CTL_RO_NL_GEN(opt_percpu_arena, percpu_arena_mode_names[opt_percpu_arena],
const char *) 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_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_max_background_threads, opt_max_background_threads, size_t)
CTL_RO_NL_GEN(opt_dirty_decay_ms, opt_dirty_decay_ms, ssize_t) CTL_RO_NL_GEN(opt_dirty_decay_ms, opt_dirty_decay_ms, ssize_t)

View File

@ -1240,15 +1240,15 @@ malloc_conf_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) {
-1, (sizeof(size_t) << 3) - 1) -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 * undocumented. It may be tweaked in the next major
* release (6.0). The default value 8M is rather * release (6.0). The default value 8M is rather
* conservative / safe. Tuning it further down may * conservative / safe. Tuning it further down may
* improve fragmentation a bit more, but may also cause * improve fragmentation a bit more, but may also cause
* contention on the huge arena. * contention on the huge arena.
*/ */
CONF_HANDLE_SIZE_T(opt_huge_threshold, CONF_HANDLE_SIZE_T(opt_oversize_threshold,
"huge_threshold", SC_LARGE_MINCLASS, "oversize_threshold", SC_LARGE_MINCLASS,
SC_LARGE_MAXCLASS, yes, yes, false) SC_LARGE_MAXCLASS, yes, yes, false)
CONF_HANDLE_SIZE_T(opt_lg_extent_max_active_fit, CONF_HANDLE_SIZE_T(opt_lg_extent_max_active_fit,
"lg_extent_max_active_fit", 0, "lg_extent_max_active_fit", 0,

View File

@ -1028,7 +1028,7 @@ stats_general_print(emitter_t *emitter) {
OPT_WRITE_CHAR_P("dss") OPT_WRITE_CHAR_P("dss")
OPT_WRITE_UNSIGNED("narenas") OPT_WRITE_UNSIGNED("narenas")
OPT_WRITE_CHAR_P("percpu_arena") 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_CHAR_P("metadata_thp")
OPT_WRITE_BOOL_MUTABLE("background_thread", "background_thread") OPT_WRITE_BOOL_MUTABLE("background_thread", "background_thread")
OPT_WRITE_SSIZE_T_MUTABLE("dirty_decay_ms", "arenas.dirty_decay_ms") OPT_WRITE_SSIZE_T_MUTABLE("dirty_decay_ms", "arenas.dirty_decay_ms")

View File

@ -1,7 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
/* Threshold: 2 << 20 = 2097152. */ /* Threshold: 2 << 20 = 2097152. */
const char *malloc_conf = "huge_threshold:2097152"; const char *malloc_conf = "oversize_threshold:2097152";
#define HUGE_SZ (2 << 20) #define HUGE_SZ (2 << 20)
#define SMALL_SZ (8) #define SMALL_SZ (8)

View File

@ -164,7 +164,7 @@ TEST_BEGIN(test_mallctl_opt) {
TEST_MALLCTL_OPT(const char *, dss, always); TEST_MALLCTL_OPT(const char *, dss, always);
TEST_MALLCTL_OPT(unsigned, narenas, always); TEST_MALLCTL_OPT(unsigned, narenas, always);
TEST_MALLCTL_OPT(const char *, percpu_arena, 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(bool, background_thread, always);
TEST_MALLCTL_OPT(ssize_t, dirty_decay_ms, always); TEST_MALLCTL_OPT(ssize_t, dirty_decay_ms, always);
TEST_MALLCTL_OPT(ssize_t, muzzy_decay_ms, always); TEST_MALLCTL_OPT(ssize_t, muzzy_decay_ms, always);
@ -342,7 +342,7 @@ TEST_BEGIN(test_thread_arena) {
sz = sizeof(unsigned); sz = sizeof(unsigned);
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0), assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
0, "Unexpected mallctl() failure"); 0, "Unexpected mallctl() failure");
if (opt_huge_threshold != 0) { if (opt_oversize_threshold != 0) {
narenas--; narenas--;
} }
assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect"); assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");