mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 01:27:19 +03:00
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.
This commit is contained in:
parent
46c0af68bd
commit
be8e59f5a6
3 changed files with 6 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue