Tcache: Add tcache gc delay option.

This can reduce flushing frequency for small size classes.
This commit is contained in:
David Goldblatt
2020-05-11 16:24:17 -07:00
committed by David Goldblatt
parent d338dd45d7
commit ee72bf1cfd
4 changed files with 99 additions and 27 deletions

View File

@@ -9,6 +9,7 @@ extern unsigned opt_tcache_nslots_small_max;
extern unsigned opt_tcache_nslots_large;
extern ssize_t opt_lg_tcache_shift;
extern size_t opt_tcache_gc_incr_bytes;
extern size_t opt_tcache_gc_delay_bytes;
/*
* Number of tcache bins. There are SC_NBINS small-object bins, plus 0 or more

View File

@@ -36,6 +36,11 @@ struct tcache_slow_s {
uint8_t lg_fill_div[SC_NBINS];
/* For small bins, whether has been refilled since last GC. */
bool bin_refilled[SC_NBINS];
/*
* For small bins, the number of items we can pretend to flush before
* actually flushing.
*/
uint8_t bin_flush_delay_items[SC_NBINS];
/*
* The start of the allocation containing the dynamic allocation for
* either the cache bins alone, or the cache bin memory as well as this