Tcache batching: Plumbing

In the next commit, we'll start using the batcher to eliminate mutex traffic.
To avoid cluttering up that commit with the random bits of busy-work it entails,
we'll centralize them here.  This commit introduces:
- A batched bin type.
- The ability to mix batched and unbatched bins in the arena.
- Conf parsing to set batches per size and a max batched size.
- mallctl access to the corresponding opt-namespace keys.
- Stats output of the above.
This commit is contained in:
David Goldblatt 2024-02-02 13:20:14 -08:00 committed by David Goldblatt
parent 70c94d7474
commit c085530c71
11 changed files with 121 additions and 35 deletions

View file

@ -3,8 +3,15 @@
#include "jemalloc/internal/bin_info.h"
size_t opt_bin_info_max_batched_size;
size_t opt_bin_info_remote_free_max_batch;
bin_info_t bin_infos[SC_NBINS];
szind_t bin_info_nbatched_sizes;
unsigned bin_info_nbatched_bins;
unsigned bin_info_nunbatched_bins;
static void
bin_infos_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
bin_info_t infos[SC_NBINS]) {
@ -20,6 +27,12 @@ bin_infos_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
bitmap_info_t bitmap_info = BITMAP_INFO_INITIALIZER(
bin_info->nregs);
bin_info->bitmap_info = bitmap_info;
if (bin_info->reg_size <= opt_bin_info_max_batched_size) {
bin_info_nbatched_sizes++;
bin_info_nbatched_bins += bin_info->n_shards;
} else {
bin_info_nunbatched_bins += bin_info->n_shards;
}
}
}