summaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorBen Maurer <bmaurer@fb.com>2014-04-05 22:59:08 (GMT)
committerBen Maurer <bmaurer@fb.com>2014-04-05 22:59:08 (GMT)
commitbe8e59f5a64ef775c9694aee0d6a87d92336d303 (patch)
treedaf932cc9677842166eed330559acbef1000d27e /src/jemalloc.c
parent46c0af68bd248b04df75e4f92d5fb804c3d75340 (diff)
downloadjemalloc-be8e59f5a64ef775c9694aee0d6a87d92336d303.zip
jemalloc-be8e59f5a64ef775c9694aee0d6a87d92336d303.tar.gz
jemalloc-be8e59f5a64ef775c9694aee0d6a87d92336d303.tar.bz2
Don't dereference chunk->arena in free() hot path
When you call free() we load chunk->arena even though that data isn't used on the tcache hot path. In profiling some FB applications, I found that ~30% of the dTLB misses in the free() function come from this line. With 4 MB chunks, the arena_chunk_t->map is ~ 32 KB (1024 pages in the chunk, 4 8 byte pointers in arena_chunk_map_t). This means there's only a 1/8 chance of the page containing chunk->arena also comtaining the map bits.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 204778b..558dbb2 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -2103,7 +2103,7 @@ a0free(void *ptr)
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
if (chunk != ptr)
- arena_dalloc(chunk->arena, chunk, ptr, false);
+ arena_dalloc(chunk, ptr, false);
else
huge_dalloc(ptr, true);
}