Wrap mallctl* references with JEMALLOC_P().
This commit is contained in:
parent
376b1529a3
commit
cd90fca928
@ -73,7 +73,8 @@ int ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
|||||||
bool ctl_boot(void);
|
bool ctl_boot(void);
|
||||||
|
|
||||||
#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
|
#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
|
||||||
if (mallctl(name, oldp, oldlenp, newp, newlen) != 0) { \
|
if (JEMALLOC_P(mallctl)(name, oldp, oldlenp, newp, newlen) \
|
||||||
|
!= 0) { \
|
||||||
malloc_write4("<jemalloc>: Invalid xmallctl(\"", name, \
|
malloc_write4("<jemalloc>: Invalid xmallctl(\"", name, \
|
||||||
"\", ...) call\n", ""); \
|
"\", ...) call\n", ""); \
|
||||||
abort(); \
|
abort(); \
|
||||||
@ -81,7 +82,7 @@ bool ctl_boot(void);
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define xmallctlnametomib(name, mibp, miblenp) do { \
|
#define xmallctlnametomib(name, mibp, miblenp) do { \
|
||||||
if (mallctlnametomib(name, mibp, miblenp) != 0) { \
|
if (JEMALLOC_P(mallctlnametomib)(name, mibp, miblenp) != 0) { \
|
||||||
malloc_write4( \
|
malloc_write4( \
|
||||||
"<jemalloc>: Invalid xmallctlnametomib(\"", name, \
|
"<jemalloc>: Invalid xmallctlnametomib(\"", name, \
|
||||||
"\", ...) call\n", ""); \
|
"\", ...) call\n", ""); \
|
||||||
@ -90,8 +91,8 @@ bool ctl_boot(void);
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
|
#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
|
||||||
if (mallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) \
|
if (JEMALLOC_P(mallctlbymib)(mib, miblen, oldp, oldlenp, newp, \
|
||||||
!= 0) { \
|
newlen) != 0) { \
|
||||||
malloc_write4( \
|
malloc_write4( \
|
||||||
"<jemalloc>: Invalid xmallctlbymib() call\n", "", \
|
"<jemalloc>: Invalid xmallctlbymib() call\n", "", \
|
||||||
"", ""); \
|
"", ""); \
|
||||||
|
@ -429,24 +429,33 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
"\n", "");
|
"\n", "");
|
||||||
|
|
||||||
write4(w4opaque, "Boolean JEMALLOC_OPTIONS: ", "", "", "");
|
write4(w4opaque, "Boolean JEMALLOC_OPTIONS: ", "", "", "");
|
||||||
if ((err = mallctl("opt.abort", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.abort", &bv, &bsz, NULL, 0))
|
||||||
|
== 0)
|
||||||
write4(w4opaque, bv ? "A" : "a", "", "", "");
|
write4(w4opaque, bv ? "A" : "a", "", "", "");
|
||||||
if ((err = mallctl("opt.prof", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.prof", &bv, &bsz, NULL, 0))
|
||||||
|
== 0)
|
||||||
write4(w4opaque, bv ? "F" : "f", "", "", "");
|
write4(w4opaque, bv ? "F" : "f", "", "", "");
|
||||||
if ((err = mallctl("opt.junk", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.junk", &bv, &bsz, NULL, 0))
|
||||||
|
== 0)
|
||||||
write4(w4opaque, bv ? "J" : "j", "", "", "");
|
write4(w4opaque, bv ? "J" : "j", "", "", "");
|
||||||
if ((err = mallctl("opt.prof_leak", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.prof_leak", &bv, &bsz, NULL,
|
||||||
|
0)) == 0)
|
||||||
write4(w4opaque, bv ? "L" : "l", "", "", "");
|
write4(w4opaque, bv ? "L" : "l", "", "", "");
|
||||||
if ((err = mallctl("opt.overcommit", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.overcommit", &bv, &bsz,
|
||||||
|
NULL, 0)) == 0)
|
||||||
write4(w4opaque, bv ? "O" : "o", "", "", "");
|
write4(w4opaque, bv ? "O" : "o", "", "", "");
|
||||||
write4(w4opaque, "P", "", "", "");
|
write4(w4opaque, "P", "", "", "");
|
||||||
if ((err = mallctl("opt.prof_udump", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.prof_udump", &bv, &bsz,
|
||||||
|
NULL, 0)) == 0)
|
||||||
write4(w4opaque, bv ? "U" : "u", "", "", "");
|
write4(w4opaque, bv ? "U" : "u", "", "", "");
|
||||||
if ((err = mallctl("opt.sysv", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.sysv", &bv, &bsz, NULL, 0))
|
||||||
|
== 0)
|
||||||
write4(w4opaque, bv ? "V" : "v", "", "", "");
|
write4(w4opaque, bv ? "V" : "v", "", "", "");
|
||||||
if ((err = mallctl("opt.xmalloc", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.xmalloc", &bv, &bsz, NULL,
|
||||||
|
0)) == 0)
|
||||||
write4(w4opaque, bv ? "X" : "x", "", "", "");
|
write4(w4opaque, bv ? "X" : "x", "", "", "");
|
||||||
if ((err = mallctl("opt.zero", &bv, &bsz, NULL, 0)) == 0)
|
if ((err = JEMALLOC_P(mallctl)("opt.zero", &bv, &bsz, NULL, 0))
|
||||||
|
== 0)
|
||||||
write4(w4opaque, bv ? "Z" : "z", "", "", "");
|
write4(w4opaque, bv ? "Z" : "z", "", "", "");
|
||||||
write4(w4opaque, "\n", "", "", "");
|
write4(w4opaque, "\n", "", "", "");
|
||||||
|
|
||||||
@ -473,8 +482,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
write4(w4opaque, "Medium spacing: ", umax2s(sv, 10, s), "\n",
|
write4(w4opaque, "Medium spacing: ", umax2s(sv, 10, s), "\n",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
if ((err = mallctl("arenas.tspace_min", &sv, &ssz, NULL, 0)) ==
|
if ((err = JEMALLOC_P(mallctl)("arenas.tspace_min", &sv, &ssz,
|
||||||
0) {
|
NULL, 0)) == 0) {
|
||||||
write4(w4opaque, "Tiny 2^n-spaced sizes: [", umax2s(sv,
|
write4(w4opaque, "Tiny 2^n-spaced sizes: [", umax2s(sv,
|
||||||
10, s), "..", "");
|
10, s), "..", "");
|
||||||
|
|
||||||
@ -516,8 +525,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
"Min active:dirty page ratio per arena: N/A\n", "",
|
"Min active:dirty page ratio per arena: N/A\n", "",
|
||||||
"", "");
|
"", "");
|
||||||
}
|
}
|
||||||
if ((err = mallctl("opt.lg_tcache_nslots", &sv, &ssz, NULL, 0))
|
if ((err = JEMALLOC_P(mallctl)("opt.lg_tcache_nslots", &sv,
|
||||||
== 0) {
|
&ssz, NULL, 0)) == 0) {
|
||||||
size_t tcache_nslots, tcache_gc_sweep;
|
size_t tcache_nslots, tcache_gc_sweep;
|
||||||
|
|
||||||
tcache_nslots = (1U << sv);
|
tcache_nslots = (1U << sv);
|
||||||
@ -531,13 +540,13 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
tcache_nslots && ssv >= 0 ? umax2s(tcache_gc_sweep,
|
tcache_nslots && ssv >= 0 ? umax2s(tcache_gc_sweep,
|
||||||
10, s) : "N/A", "\n", "");
|
10, s) : "N/A", "\n", "");
|
||||||
}
|
}
|
||||||
if ((err = mallctl("opt.lg_prof_bt_max", &sv, &ssz, NULL, 0))
|
if ((err = JEMALLOC_P(mallctl)("opt.lg_prof_bt_max", &sv, &ssz,
|
||||||
== 0) {
|
NULL, 0)) == 0) {
|
||||||
write4(w4opaque, "Maximum profile backtrace depth: ",
|
write4(w4opaque, "Maximum profile backtrace depth: ",
|
||||||
umax2s((1U << sv), 10, s), "\n", "");
|
umax2s((1U << sv), 10, s), "\n", "");
|
||||||
}
|
}
|
||||||
if ((err = mallctl("opt.lg_prof_interval", &sv, &ssz, NULL, 0))
|
if ((err = JEMALLOC_P(mallctl)("opt.lg_prof_interval", &sv,
|
||||||
== 0) {
|
&ssz, NULL, 0)) == 0) {
|
||||||
write4(w4opaque, "Average profile dump interval: ",
|
write4(w4opaque, "Average profile dump interval: ",
|
||||||
umax2s((1U << sv), 10, s), "", "");
|
umax2s((1U << sv), 10, s), "", "");
|
||||||
write4(w4opaque, " (2^", umax2s(sv, 10, s), ")\n", "");
|
write4(w4opaque, " (2^", umax2s(sv, 10, s), ")\n", "");
|
||||||
@ -571,8 +580,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
CTL_GET("stats.chunks.total", &chunks_total, uint64_t);
|
CTL_GET("stats.chunks.total", &chunks_total, uint64_t);
|
||||||
CTL_GET("stats.chunks.high", &chunks_high, size_t);
|
CTL_GET("stats.chunks.high", &chunks_high, size_t);
|
||||||
CTL_GET("stats.chunks.current", &chunks_current, size_t);
|
CTL_GET("stats.chunks.current", &chunks_current, size_t);
|
||||||
if ((err = mallctl("swap.avail", &swap_avail, &ssz, NULL, 0))
|
if ((err = JEMALLOC_P(mallctl)("swap.avail", &swap_avail, &ssz,
|
||||||
== 0) {
|
NULL, 0)) == 0) {
|
||||||
size_t lg_chunk;
|
size_t lg_chunk;
|
||||||
|
|
||||||
malloc_cprintf(write4, w4opaque, "chunks: nchunks "
|
malloc_cprintf(write4, w4opaque, "chunks: nchunks "
|
||||||
|
Loading…
Reference in New Issue
Block a user