From 90c627edb70e081e1298b79010478d2f804467f1 Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Fri, 31 May 2024 10:28:58 -0700 Subject: [PATCH] Export hugepage size with `arenas.hugepage` --- src/ctl.c | 3 +++ src/stats.c | 4 ++++ test/unit/mallctl.c | 1 + 3 files changed, 8 insertions(+) diff --git a/src/ctl.c b/src/ctl.c index 09188dd9..4347dd2b 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -195,6 +195,7 @@ CTL_PROTO(arenas_dirty_decay_ms) CTL_PROTO(arenas_muzzy_decay_ms) CTL_PROTO(arenas_quantum) CTL_PROTO(arenas_page) +CTL_PROTO(arenas_hugepage) CTL_PROTO(arenas_tcache_max) CTL_PROTO(arenas_nbins) CTL_PROTO(arenas_nhbins) @@ -593,6 +594,7 @@ static const ctl_named_node_t arenas_node[] = { {NAME("muzzy_decay_ms"), CTL(arenas_muzzy_decay_ms)}, {NAME("quantum"), CTL(arenas_quantum)}, {NAME("page"), CTL(arenas_page)}, + {NAME("hugepage"), CTL(arenas_hugepage)}, {NAME("tcache_max"), CTL(arenas_tcache_max)}, {NAME("nbins"), CTL(arenas_nbins)}, {NAME("nhbins"), CTL(arenas_nhbins)}, @@ -3284,6 +3286,7 @@ arenas_muzzy_decay_ms_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, CTL_RO_NL_GEN(arenas_quantum, QUANTUM, size_t) CTL_RO_NL_GEN(arenas_page, PAGE, size_t) +CTL_RO_NL_GEN(arenas_hugepage, HUGEPAGE, size_t) CTL_RO_NL_GEN(arenas_tcache_max, global_do_not_change_tcache_maxclass, size_t) CTL_RO_NL_GEN(arenas_nbins, SC_NBINS, unsigned) CTL_RO_NL_GEN(arenas_nhbins, global_do_not_change_tcache_nbins, unsigned) diff --git a/src/stats.c b/src/stats.c index 8419158a..4df0ae62 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1698,6 +1698,10 @@ stats_general_print(emitter_t *emitter) { CTL_GET("arenas.page", &sv, size_t); emitter_kv(emitter, "page", "Page size", emitter_type_size, &sv); + CTL_GET("arenas.hugepage", &sv, size_t); + emitter_kv(emitter, "hugepage", "Hugepage size", emitter_type_size, + &sv); + if (je_mallctl("arenas.tcache_max", (void *)&sv, &ssz, NULL, 0) == 0) { emitter_kv(emitter, "tcache_max", "Maximum thread-cached size class", emitter_type_size, &sv); diff --git a/test/unit/mallctl.c b/test/unit/mallctl.c index 9e5baff0..84cd3995 100644 --- a/test/unit/mallctl.c +++ b/test/unit/mallctl.c @@ -877,6 +877,7 @@ TEST_BEGIN(test_arenas_constants) { TEST_ARENAS_CONSTANT(size_t, quantum, QUANTUM); TEST_ARENAS_CONSTANT(size_t, page, PAGE); + TEST_ARENAS_CONSTANT(size_t, hugepage, HUGEPAGE); TEST_ARENAS_CONSTANT(unsigned, nbins, SC_NBINS); TEST_ARENAS_CONSTANT(unsigned, nlextents, SC_NSIZES - SC_NBINS);