Remove the opt.lg_prof_tcmax option.
Remove the opt.lg_prof_tcmax option and hard-code a cache size of 1024. This setting is something that users just shouldn't have to worry about. If lock contention actually ends up being a problem, the simple solution available to the user is to reduce sampling frequency.
This commit is contained in:
parent
e7a1058aaa
commit
0b526ff94d
@ -938,8 +938,6 @@ malloc_conf = "xmalloc:true";]]></programlisting>
|
|||||||
option for probabilistic sampling control. See the <link
|
option for probabilistic sampling control. See the <link
|
||||||
linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link>
|
linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link>
|
||||||
option for control of cumulative sample reporting. See the <link
|
option for control of cumulative sample reporting. See the <link
|
||||||
linkend="opt.lg_prof_tcmax"><mallctl>opt.lg_prof_tcmax</mallctl></link>
|
|
||||||
option for control of per thread backtrace caching. See the <link
|
|
||||||
linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
|
linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
|
||||||
option for information on interval-triggered profile dumping, and the
|
option for information on interval-triggered profile dumping, and the
|
||||||
<link linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link>
|
<link linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link>
|
||||||
@ -1017,28 +1015,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
|
|||||||
dumps enabled/disabled. If this option is enabled, every unique
|
dumps enabled/disabled. If this option is enabled, every unique
|
||||||
backtrace must be stored for the duration of execution. Depending on
|
backtrace must be stored for the duration of execution. Depending on
|
||||||
the application, this can impose a large memory overhead, and the
|
the application, this can impose a large memory overhead, and the
|
||||||
cumulative counts are not always of interest. See the
|
cumulative counts are not always of interest. This option is enabled
|
||||||
<link
|
by default.</para></listitem>
|
||||||
linkend="opt.lg_prof_tcmax"><mallctl>opt.lg_prof_tcmax</mallctl></link>
|
|
||||||
option for control of per thread backtrace caching, which has important
|
|
||||||
interactions. This option is enabled by default.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry id="opt.lg_prof_tcmax">
|
|
||||||
<term>
|
|
||||||
<mallctl>opt.lg_prof_tcmax</mallctl>
|
|
||||||
(<type>ssize_t</type>)
|
|
||||||
<literal>r-</literal>
|
|
||||||
[<option>--enable-prof</option>]
|
|
||||||
</term>
|
|
||||||
<listitem><para>Maximum per thread backtrace cache (log base 2) used
|
|
||||||
for heap profiling. A backtrace can only be discarded if the
|
|
||||||
<link linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link>
|
|
||||||
option is disabled, and no thread caches currently refer to the
|
|
||||||
backtrace. Therefore, a backtrace cache limit should be imposed if the
|
|
||||||
intention is to limit how much memory is used by backtraces. By
|
|
||||||
default, no limit is imposed (encoded as -1).
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry id="opt.lg_prof_interval">
|
<varlistentry id="opt.lg_prof_interval">
|
||||||
|
@ -12,7 +12,9 @@ typedef struct prof_tdata_s prof_tdata_t;
|
|||||||
#define LG_PROF_BT_MAX_DEFAULT 7
|
#define LG_PROF_BT_MAX_DEFAULT 7
|
||||||
#define LG_PROF_SAMPLE_DEFAULT 0
|
#define LG_PROF_SAMPLE_DEFAULT 0
|
||||||
#define LG_PROF_INTERVAL_DEFAULT -1
|
#define LG_PROF_INTERVAL_DEFAULT -1
|
||||||
#define LG_PROF_TCMAX_DEFAULT -1
|
|
||||||
|
/* Maximum number of backtraces to store in each per thread LRU cache. */
|
||||||
|
#define PROF_TCMAX 1024
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hard limit on stack backtrace depth. Note that the version of
|
* Hard limit on stack backtrace depth. Note that the version of
|
||||||
@ -167,7 +169,6 @@ extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */
|
|||||||
extern bool opt_prof_gdump; /* High-water memory dumping. */
|
extern bool opt_prof_gdump; /* High-water memory dumping. */
|
||||||
extern bool opt_prof_leak; /* Dump leak summary at exit. */
|
extern bool opt_prof_leak; /* Dump leak summary at exit. */
|
||||||
extern bool opt_prof_accum; /* Report cumulative bytes. */
|
extern bool opt_prof_accum; /* Report cumulative bytes. */
|
||||||
extern ssize_t opt_lg_prof_tcmax; /* lg(max per thread bactrace cache) */
|
|
||||||
extern char opt_prof_prefix[PATH_MAX + 1];
|
extern char opt_prof_prefix[PATH_MAX + 1];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -80,7 +80,6 @@ CTL_PROTO(opt_lg_prof_interval)
|
|||||||
CTL_PROTO(opt_prof_gdump)
|
CTL_PROTO(opt_prof_gdump)
|
||||||
CTL_PROTO(opt_prof_leak)
|
CTL_PROTO(opt_prof_leak)
|
||||||
CTL_PROTO(opt_prof_accum)
|
CTL_PROTO(opt_prof_accum)
|
||||||
CTL_PROTO(opt_lg_prof_tcmax)
|
|
||||||
CTL_PROTO(arenas_bin_i_size)
|
CTL_PROTO(arenas_bin_i_size)
|
||||||
CTL_PROTO(arenas_bin_i_nregs)
|
CTL_PROTO(arenas_bin_i_nregs)
|
||||||
CTL_PROTO(arenas_bin_i_run_size)
|
CTL_PROTO(arenas_bin_i_run_size)
|
||||||
@ -222,8 +221,7 @@ static const ctl_node_t opt_node[] = {
|
|||||||
{NAME("lg_prof_interval"), CTL(opt_lg_prof_interval)},
|
{NAME("lg_prof_interval"), CTL(opt_lg_prof_interval)},
|
||||||
{NAME("prof_gdump"), CTL(opt_prof_gdump)},
|
{NAME("prof_gdump"), CTL(opt_prof_gdump)},
|
||||||
{NAME("prof_leak"), CTL(opt_prof_leak)},
|
{NAME("prof_leak"), CTL(opt_prof_leak)},
|
||||||
{NAME("prof_accum"), CTL(opt_prof_accum)},
|
{NAME("prof_accum"), CTL(opt_prof_accum)}
|
||||||
{NAME("lg_prof_tcmax"), CTL(opt_lg_prof_tcmax)}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ctl_node_t arenas_bin_i_node[] = {
|
static const ctl_node_t arenas_bin_i_node[] = {
|
||||||
@ -1133,7 +1131,6 @@ CTL_RO_NL_CGEN(config_prof, opt_lg_prof_interval, opt_lg_prof_interval, ssize_t)
|
|||||||
CTL_RO_NL_CGEN(config_prof, opt_prof_gdump, opt_prof_gdump, bool)
|
CTL_RO_NL_CGEN(config_prof, opt_prof_gdump, opt_prof_gdump, bool)
|
||||||
CTL_RO_NL_CGEN(config_prof, opt_prof_leak, opt_prof_leak, bool)
|
CTL_RO_NL_CGEN(config_prof, opt_prof_leak, opt_prof_leak, bool)
|
||||||
CTL_RO_NL_CGEN(config_prof, opt_prof_accum, opt_prof_accum, bool)
|
CTL_RO_NL_CGEN(config_prof, opt_prof_accum, opt_prof_accum, bool)
|
||||||
CTL_RO_NL_CGEN(config_prof, opt_lg_prof_tcmax, opt_lg_prof_tcmax, ssize_t)
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
@ -603,8 +603,6 @@ malloc_conf_init(void)
|
|||||||
CONF_HANDLE_SSIZE_T(lg_prof_sample, 0,
|
CONF_HANDLE_SSIZE_T(lg_prof_sample, 0,
|
||||||
(sizeof(uint64_t) << 3) - 1)
|
(sizeof(uint64_t) << 3) - 1)
|
||||||
CONF_HANDLE_BOOL(prof_accum)
|
CONF_HANDLE_BOOL(prof_accum)
|
||||||
CONF_HANDLE_SSIZE_T(lg_prof_tcmax, -1,
|
|
||||||
(sizeof(size_t) << 3) - 1)
|
|
||||||
CONF_HANDLE_SSIZE_T(lg_prof_interval, -1,
|
CONF_HANDLE_SSIZE_T(lg_prof_interval, -1,
|
||||||
(sizeof(uint64_t) << 3) - 1)
|
(sizeof(uint64_t) << 3) - 1)
|
||||||
CONF_HANDLE_BOOL(prof_gdump)
|
CONF_HANDLE_BOOL(prof_gdump)
|
||||||
|
@ -22,7 +22,6 @@ ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT;
|
|||||||
bool opt_prof_gdump = false;
|
bool opt_prof_gdump = false;
|
||||||
bool opt_prof_leak = false;
|
bool opt_prof_leak = false;
|
||||||
bool opt_prof_accum = true;
|
bool opt_prof_accum = true;
|
||||||
ssize_t opt_lg_prof_tcmax = LG_PROF_TCMAX_DEFAULT;
|
|
||||||
char opt_prof_prefix[PATH_MAX + 1];
|
char opt_prof_prefix[PATH_MAX + 1];
|
||||||
|
|
||||||
uint64_t prof_interval;
|
uint64_t prof_interval;
|
||||||
@ -519,8 +518,7 @@ prof_lookup(prof_bt_t *bt)
|
|||||||
prof_leave();
|
prof_leave();
|
||||||
|
|
||||||
/* Link a prof_thd_cnt_t into ctx for this thread. */
|
/* Link a prof_thd_cnt_t into ctx for this thread. */
|
||||||
if (opt_lg_prof_tcmax >= 0 && ckh_count(&prof_tdata->bt2cnt)
|
if (ckh_count(&prof_tdata->bt2cnt) == PROF_TCMAX) {
|
||||||
== (ZU(1) << opt_lg_prof_tcmax)) {
|
|
||||||
assert(ckh_count(&prof_tdata->bt2cnt) > 0);
|
assert(ckh_count(&prof_tdata->bt2cnt) > 0);
|
||||||
/*
|
/*
|
||||||
* Flush the least recently used cnt in order to keep
|
* Flush the least recently used cnt in order to keep
|
||||||
@ -535,9 +533,7 @@ prof_lookup(prof_bt_t *bt)
|
|||||||
prof_ctx_merge(ret.p->ctx, ret.p);
|
prof_ctx_merge(ret.p->ctx, ret.p);
|
||||||
/* ret can now be re-used. */
|
/* ret can now be re-used. */
|
||||||
} else {
|
} else {
|
||||||
assert(opt_lg_prof_tcmax < 0 ||
|
assert(ckh_count(&prof_tdata->bt2cnt) < PROF_TCMAX);
|
||||||
ckh_count(&prof_tdata->bt2cnt) < (ZU(1) <<
|
|
||||||
opt_lg_prof_tcmax));
|
|
||||||
/* Allocate and partially initialize a new cnt. */
|
/* Allocate and partially initialize a new cnt. */
|
||||||
ret.v = imalloc(sizeof(prof_thr_cnt_t));
|
ret.v = imalloc(sizeof(prof_thr_cnt_t));
|
||||||
if (ret.p == NULL) {
|
if (ret.p == NULL) {
|
||||||
|
12
src/stats.c
12
src/stats.c
@ -515,7 +515,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
OPT_WRITE_BOOL(prof_active)
|
OPT_WRITE_BOOL(prof_active)
|
||||||
OPT_WRITE_SSIZE_T(lg_prof_sample)
|
OPT_WRITE_SSIZE_T(lg_prof_sample)
|
||||||
OPT_WRITE_BOOL(prof_accum)
|
OPT_WRITE_BOOL(prof_accum)
|
||||||
OPT_WRITE_SSIZE_T(lg_prof_tcmax)
|
|
||||||
OPT_WRITE_SSIZE_T(lg_prof_interval)
|
OPT_WRITE_SSIZE_T(lg_prof_interval)
|
||||||
OPT_WRITE_BOOL(prof_gdump)
|
OPT_WRITE_BOOL(prof_gdump)
|
||||||
OPT_WRITE_BOOL(prof_leak)
|
OPT_WRITE_BOOL(prof_leak)
|
||||||
@ -622,17 +621,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
write_cb(cbopaque, u2s((1U << sv), 10, s));
|
write_cb(cbopaque, u2s((1U << sv), 10, s));
|
||||||
write_cb(cbopaque, "\n");
|
write_cb(cbopaque, "\n");
|
||||||
|
|
||||||
CTL_GET("opt.lg_prof_tcmax", &ssv, ssize_t);
|
|
||||||
write_cb(cbopaque,
|
|
||||||
"Maximum per thread backtrace cache: ");
|
|
||||||
if (ssv >= 0) {
|
|
||||||
write_cb(cbopaque, u2s((1U << ssv), 10, s));
|
|
||||||
write_cb(cbopaque, " (2^");
|
|
||||||
write_cb(cbopaque, u2s(ssv, 10, s));
|
|
||||||
write_cb(cbopaque, ")\n");
|
|
||||||
} else
|
|
||||||
write_cb(cbopaque, "N/A\n");
|
|
||||||
|
|
||||||
CTL_GET("opt.lg_prof_sample", &sv, size_t);
|
CTL_GET("opt.lg_prof_sample", &sv, size_t);
|
||||||
write_cb(cbopaque, "Average profile sample interval: ");
|
write_cb(cbopaque, "Average profile sample interval: ");
|
||||||
write_cb(cbopaque, u2s((((uint64_t)1U) << sv), 10, s));
|
write_cb(cbopaque, u2s((((uint64_t)1U) << sv), 10, s));
|
||||||
|
Loading…
Reference in New Issue
Block a user