mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
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:
committed by
David Goldblatt
parent
70c94d7474
commit
c085530c71
18
src/bin.c
18
src/bin.c
@@ -54,16 +54,28 @@ bin_init(bin_t *bin) {
|
||||
}
|
||||
|
||||
void
|
||||
bin_prefork(tsdn_t *tsdn, bin_t *bin) {
|
||||
bin_prefork(tsdn_t *tsdn, bin_t *bin, bool has_batch) {
|
||||
malloc_mutex_prefork(tsdn, &bin->lock);
|
||||
if (has_batch) {
|
||||
bin_with_batch_t *batched = (bin_with_batch_t *)bin;
|
||||
batcher_prefork(tsdn, &batched->remote_frees);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bin_postfork_parent(tsdn_t *tsdn, bin_t *bin) {
|
||||
bin_postfork_parent(tsdn_t *tsdn, bin_t *bin, bool has_batch) {
|
||||
malloc_mutex_postfork_parent(tsdn, &bin->lock);
|
||||
if (has_batch) {
|
||||
bin_with_batch_t *batched = (bin_with_batch_t *)bin;
|
||||
batcher_postfork_parent(tsdn, &batched->remote_frees);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bin_postfork_child(tsdn_t *tsdn, bin_t *bin) {
|
||||
bin_postfork_child(tsdn_t *tsdn, bin_t *bin, bool has_batch) {
|
||||
malloc_mutex_postfork_child(tsdn, &bin->lock);
|
||||
if (has_batch) {
|
||||
bin_with_batch_t *batched = (bin_with_batch_t *)bin;
|
||||
batcher_postfork_child(tsdn, &batched->remote_frees);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user