aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2015-05-19 17:47:16 -0700
committerChristopher Ferris <cferris@google.com>2015-05-20 12:09:54 -0700
commit83d543f8689bc7c6142179a5491bdf2a31b5cfc7 (patch)
treee50e20f212bae961e9a4781a9fba860a817632a0 /src
parentd24af195bf44844eb4baffbacd63100b8fe01472 (diff)
downloadjemalloc-83d543f8689bc7c6142179a5491bdf2a31b5cfc7.tar.gz
Impose a minimum tcache count for small size classes.
Now that small allocation runs have fewer regions due to run metadata residing in chunk headers, an explicit minimum tcache count is needed to make sure that tcache adequately amortizes synchronization overhead. Bug: 21326736 (cherry picked from commit 836bbe9951a903b2d76af53dfb3ad53ad186f8b9) Change-Id: I4aaf29240799642de77b3b79a3507d2789f23542
Diffstat (limited to 'src')
-rw-r--r--src/tcache.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tcache.c b/src/tcache.c
index 83e7e36..3814365 100644
--- a/src/tcache.c
+++ b/src/tcache.c
@@ -515,7 +515,11 @@ tcache_boot(void)
return (true);
stack_nelms = 0;
for (i = 0; i < NBINS; i++) {
- if ((arena_bin_info[i].nregs << 1) <= TCACHE_NSLOTS_SMALL_MAX) {
+ if ((arena_bin_info[i].nregs << 1) <= TCACHE_NSLOTS_SMALL_MIN) {
+ tcache_bin_info[i].ncached_max =
+ TCACHE_NSLOTS_SMALL_MIN;
+ } else if ((arena_bin_info[i].nregs << 1) <=
+ TCACHE_NSLOTS_SMALL_MAX) {
tcache_bin_info[i].ncached_max =
(arena_bin_info[i].nregs << 1);
} else {