Introduce lockedint module.

This pulls out the various abstractions where some stats counter is sometimes an
atomic, sometimes a plain variable, sometimes always protected by a lock,
sometimes protected by reads but not writes, etc.  With this change, these cases
are treated consistently, and access patterns tagged.

In the process, we fix a few missed-update bugs (where one caller assumes
"protected-by-a-lock" semantics and another does not).
This commit is contained in:
David Goldblatt 2020-03-08 20:43:41 -07:00 committed by David Goldblatt
parent acd0bf6a26
commit 356aaa7dc6
7 changed files with 341 additions and 290 deletions

View file

@ -199,7 +199,8 @@ extents_abandon_vm(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
ecache_t *ecache, edata_t *edata, bool growing_retained) {
size_t sz = edata_size_get(edata);
if (config_stats) {
arena_stats_accum_zu(&arena->pa_shard.stats->abandoned_vm, sz);
atomic_fetch_add_zu(&arena->pa_shard.stats->abandoned_vm, sz,
ATOMIC_RELAXED);
}
/*
* Leak extent after making sure its pages have already been purged, so