Add batching to arena bins.

This adds a fast-path for threads freeing a small number of allocations to
bins which are not their "home-base" and which encounter lock contention in
attempting to do so. In producer-consumer workflows, such small lock hold times
can cause lock convoying that greatly increases overall bin mutex contention.
This commit is contained in:
David Goldblatt
2024-02-09 16:08:45 -08:00
committed by David Goldblatt
parent 44d91cf243
commit fc615739cb
16 changed files with 722 additions and 78 deletions

View File

@@ -130,6 +130,7 @@ CTL_PROTO(opt_utrace)
CTL_PROTO(opt_xmalloc)
CTL_PROTO(opt_experimental_infallible_new)
CTL_PROTO(opt_max_batched_size)
CTL_PROTO(opt_remote_free_max)
CTL_PROTO(opt_remote_free_max_batch)
CTL_PROTO(opt_tcache)
CTL_PROTO(opt_tcache_max)
@@ -483,6 +484,7 @@ static const ctl_named_node_t opt_node[] = {
{NAME("experimental_infallible_new"),
CTL(opt_experimental_infallible_new)},
{NAME("max_batched_size"), CTL(opt_max_batched_size)},
{NAME("remote_free_max"), CTL(opt_remote_free_max)},
{NAME("remote_free_max_batch"), CTL(opt_remote_free_max_batch)},
{NAME("tcache"), CTL(opt_tcache)},
{NAME("tcache_max"), CTL(opt_tcache_max)},
@@ -2208,6 +2210,8 @@ CTL_RO_NL_CGEN(config_xmalloc, opt_xmalloc, opt_xmalloc, bool)
CTL_RO_NL_CGEN(config_enable_cxx, opt_experimental_infallible_new,
opt_experimental_infallible_new, bool)
CTL_RO_NL_GEN(opt_max_batched_size, opt_bin_info_max_batched_size, size_t)
CTL_RO_NL_GEN(opt_remote_free_max, opt_bin_info_remote_free_max,
size_t)
CTL_RO_NL_GEN(opt_remote_free_max_batch, opt_bin_info_remote_free_max_batch,
size_t)
CTL_RO_NL_GEN(opt_tcache, opt_tcache, bool)