HPA: Don't track inactive pages.

This is really only useful for human consumption.  Correspondingly, emit it only
in the human-readable stats, and let everybody else compute from the hugepage
size and nactive.
This commit is contained in:
David Goldblatt 2020-12-03 18:43:10 -08:00 committed by David Goldblatt
parent 55e0f60ca1
commit be0d7a53f3
6 changed files with 9 additions and 53 deletions

View File

@ -29,8 +29,6 @@ struct psset_bin_stats_s {
size_t npageslabs;
/* Of them, how many pages are active? */
size_t nactive;
/* How many are inactive? */
size_t ninactive;
};
typedef struct psset_stats_s psset_stats_t;

View File

@ -233,16 +233,12 @@ CTL_PROTO(stats_arenas_i_hpa_shard_nhugifies)
CTL_PROTO(stats_arenas_i_hpa_shard_ndehugifies)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_npageslabs_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_nactive_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_ninactive_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_npageslabs_nonhuge)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_nactive_nonhuge)
CTL_PROTO(stats_arenas_i_hpa_shard_full_slabs_ninactive_nonhuge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_nonhuge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_nonhuge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_huge)
CTL_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_nonhuge)
INDEX_PROTO(stats_arenas_i_hpa_shard_nonfull_slabs_j)
CTL_PROTO(stats_arenas_i_nthreads)
CTL_PROTO(stats_arenas_i_uptime)
@ -659,14 +655,10 @@ static const ctl_named_node_t stats_arenas_i_hpa_shard_full_slabs_node[] = {
CTL(stats_arenas_i_hpa_shard_full_slabs_npageslabs_huge)},
{NAME("nactive_huge"),
CTL(stats_arenas_i_hpa_shard_full_slabs_nactive_huge)},
{NAME("ninactive_huge"),
CTL(stats_arenas_i_hpa_shard_full_slabs_ninactive_huge)},
{NAME("npageslabs_nonhuge"),
CTL(stats_arenas_i_hpa_shard_full_slabs_npageslabs_nonhuge)},
{NAME("nactive_nonhuge"),
CTL(stats_arenas_i_hpa_shard_full_slabs_nactive_nonhuge)},
{NAME("ninactive_nonhuge"),
CTL(stats_arenas_i_hpa_shard_full_slabs_ninactive_nonhuge)},
CTL(stats_arenas_i_hpa_shard_full_slabs_nactive_nonhuge)}
};
static const ctl_named_node_t stats_arenas_i_hpa_shard_nonfull_slabs_j_node[] = {
@ -674,14 +666,10 @@ static const ctl_named_node_t stats_arenas_i_hpa_shard_nonfull_slabs_j_node[] =
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_huge)},
{NAME("nactive_huge"),
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_huge)},
{NAME("ninactive_huge"),
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_huge)},
{NAME("npageslabs_nonhuge"),
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_nonhuge)},
{NAME("nactive_nonhuge"),
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_nonhuge)},
{NAME("ninactive_nonhuge"),
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_nonhuge)}
CTL(stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_nonhuge)}
};
static const ctl_named_node_t super_stats_arenas_i_hpa_shard_nonfull_slabs_j_node[] = {
@ -3531,8 +3519,6 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_npageslabs_nonhuge
size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_nactive_nonhuge,
arenas_i(mib[2])->astats->hpastats.psset_stats.full_slabs[0].nactive, size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_ninactive_nonhuge,
arenas_i(mib[2])->astats->hpastats.psset_stats.full_slabs[0].ninactive, size_t);
/* Full, huge */
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_npageslabs_huge,
@ -3540,8 +3526,6 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_npageslabs_huge,
size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_nactive_huge,
arenas_i(mib[2])->astats->hpastats.psset_stats.full_slabs[1].nactive, size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_full_slabs_ninactive_huge,
arenas_i(mib[2])->astats->hpastats.psset_stats.full_slabs[1].ninactive, size_t);
/* Nonfull, nonhuge */
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_nonhuge,
@ -3550,9 +3534,6 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_no
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_nonhuge,
arenas_i(mib[2])->astats->hpastats.psset_stats.nonfull_slabs[mib[5]][0].nactive,
size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_nonhuge,
arenas_i(mib[2])->astats->hpastats.psset_stats.nonfull_slabs[mib[5]][0].ninactive,
size_t);
/* Nonfull, huge */
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_huge,
@ -3561,10 +3542,6 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_npageslabs_hu
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_nactive_huge,
arenas_i(mib[2])->astats->hpastats.psset_stats.nonfull_slabs[mib[5]][1].nactive,
size_t);
CTL_RO_CGEN(config_stats, stats_arenas_i_hpa_shard_nonfull_slabs_j_ninactive_huge,
arenas_i(mib[2])->astats->hpastats.psset_stats.nonfull_slabs[mib[5]][1].ninactive,
size_t);
static const ctl_named_node_t *
stats_arenas_i_hpa_shard_nonfull_slabs_j_index(tsdn_t *tsdn, const size_t *mib,

View File

@ -664,7 +664,6 @@ static void
hpa_shard_assert_stats_empty(psset_bin_stats_t *bin_stats) {
assert(bin_stats->npageslabs == 0);
assert(bin_stats->nactive == 0);
assert(bin_stats->ninactive == 0);
}
static void

View File

@ -21,7 +21,6 @@ static void
psset_bin_stats_accum(psset_bin_stats_t *dst, psset_bin_stats_t *src) {
dst->npageslabs += src->npageslabs;
dst->nactive += src->nactive;
dst->ninactive += src->ninactive;
}
void
@ -54,7 +53,6 @@ psset_bin_stats_insert_remove(psset_bin_stats_t *binstats, hpdata_t *ps,
binstats[huge_idx].npageslabs += mul * 1;
size_t nactive = hpdata_nactive_get(ps);
binstats[huge_idx].nactive += mul * nactive;
binstats[huge_idx].ninactive += mul * (HUGEPAGE_PAGES - nactive);
}
static void

View File

@ -819,15 +819,14 @@ stats_arena_hpa_shard_print(emitter_t *emitter, unsigned i, uint64_t uptime) {
i, &npageslabs_huge, size_t);
CTL_M2_GET("stats.arenas.0.hpa_shard.full_slabs.nactive_huge",
i, &nactive_huge, size_t);
CTL_M2_GET("stats.arenas.0.hpa_shard.full_slabs.ninactive_huge",
i, &ninactive_huge, size_t);
ninactive_huge = npageslabs_huge * HUGEPAGE_PAGES - nactive_huge;
CTL_M2_GET("stats.arenas.0.hpa_shard.full_slabs.npageslabs_nonhuge",
i, &npageslabs_nonhuge, size_t);
CTL_M2_GET("stats.arenas.0.hpa_shard.full_slabs.nactive_nonhuge",
i, &nactive_nonhuge, size_t);
CTL_M2_GET("stats.arenas.0.hpa_shard.full_slabs.ninactive_nonhuge",
i, &ninactive_nonhuge, size_t);
ninactive_nonhuge = npageslabs_nonhuge * HUGEPAGE_PAGES
- nactive_nonhuge;
size_t sec_bytes;
CTL_M2_GET("stats.arenas.0.hpa_sec_bytes", i, &sec_bytes, size_t);
@ -875,10 +874,6 @@ stats_arena_hpa_shard_print(emitter_t *emitter, unsigned i, uint64_t uptime) {
&nactive_huge);
emitter_json_kv(emitter, "nactive_nonhuge", emitter_type_size,
&nactive_nonhuge);
emitter_json_kv(emitter, "ninactive_huge", emitter_type_size,
&ninactive_huge);
emitter_json_kv(emitter, "ninactive_nonhuge", emitter_type_size,
&ninactive_nonhuge);
emitter_json_object_end(emitter); /* End "full_slabs" */
COL_HDR(row, size, NULL, right, 20, size)
@ -905,14 +900,14 @@ stats_arena_hpa_shard_print(emitter_t *emitter, unsigned i, uint64_t uptime) {
&npageslabs_huge, size_t);
CTL_LEAF(stats_arenas_mib, 6, "nactive_huge",
&nactive_huge, size_t);
CTL_LEAF(stats_arenas_mib, 6, "ninactive_huge",
&ninactive_huge, size_t);
ninactive_huge = npageslabs_huge * HUGEPAGE_PAGES
- nactive_huge;
CTL_LEAF(stats_arenas_mib, 6, "npageslabs_nonhuge",
&npageslabs_nonhuge, size_t);
CTL_LEAF(stats_arenas_mib, 6, "nactive_nonhuge",
&nactive_nonhuge, size_t);
CTL_LEAF(stats_arenas_mib, 6, "ninactive_nonhuge",
&ninactive_nonhuge, size_t);
ninactive_nonhuge = npageslabs_nonhuge * HUGEPAGE_PAGES
- nactive_nonhuge;
bool in_gap_prev = in_gap;
in_gap = (npageslabs_huge == 0 && npageslabs_nonhuge == 0);
@ -938,14 +933,10 @@ stats_arena_hpa_shard_print(emitter_t *emitter, unsigned i, uint64_t uptime) {
&npageslabs_huge);
emitter_json_kv(emitter, "nactive_huge", emitter_type_size,
&nactive_huge);
emitter_json_kv(emitter, "ninactive_huge", emitter_type_size,
&ninactive_huge);
emitter_json_kv(emitter, "npageslabs_nonhuge", emitter_type_size,
&npageslabs_nonhuge);
emitter_json_kv(emitter, "nactive_nonhuge", emitter_type_size,
&nactive_nonhuge);
emitter_json_kv(emitter, "ninactive_nonhuge", emitter_type_size,
&ninactive_huge);
emitter_json_object_end(emitter);
}
emitter_json_array_end(emitter); /* End "nonfull_slabs" */

View File

@ -325,8 +325,6 @@ stats_expect_empty(psset_bin_stats_t *stats) {
"Supposedly empty bin had positive npageslabs");
expect_zu_eq(0, stats->nactive, "Unexpected nonempty bin"
"Supposedly empty bin had positive nactive");
expect_zu_eq(0, stats->ninactive, "Unexpected nonempty bin"
"Supposedly empty bin had positive ninactive");
}
static void
@ -337,8 +335,6 @@ stats_expect(psset_t *psset, size_t nactive) {
expect_zu_eq(HUGEPAGE_PAGES,
psset->stats.full_slabs[0].nactive,
"Should have exactly filled the bin");
expect_zu_eq(0, psset->stats.full_slabs[0].ninactive,
"Should never have inactive pages in a full slab");
} else {
stats_expect_empty(&psset->stats.full_slabs[0]);
}
@ -356,9 +352,6 @@ stats_expect(psset_t *psset, size_t nactive) {
expect_zu_eq(nactive,
psset->stats.nonfull_slabs[i][0].nactive,
"Mismatch in active pages");
expect_zu_eq(ninactive,
psset->stats.nonfull_slabs[i][0].ninactive,
"Mismatch in inactive pages");
} else {
stats_expect_empty(&psset->stats.nonfull_slabs[i][0]);
}