Reduce extent_node_t size to fit in one cache line.

This commit is contained in:
Jason Evans 2015-01-30 21:21:16 -08:00
parent a55dfa4b0a
commit 918a1a5b3f

View File

@ -15,9 +15,6 @@ struct extent_node_s {
/* Linkage for the address-ordered tree. */ /* Linkage for the address-ordered tree. */
rb_node(extent_node_t) link_ad; rb_node(extent_node_t) link_ad;
/* Profile counters, used for huge objects. */
prof_tctx_t *prof_tctx;
/* Pointer to the extent that this tree node is responsible for. */ /* Pointer to the extent that this tree node is responsible for. */
void *addr; void *addr;
@ -27,9 +24,18 @@ struct extent_node_s {
/* Arena from which this extent came, if any. */ /* Arena from which this extent came, if any. */
arena_t *arena; arena_t *arena;
/*
* 'prof_tctx' and 'zeroed' are never needed at the same time, so
* overlay them in order to fit extent_node_t in one cache line.
*/
union {
/* Profile counters, used for huge objects. */
prof_tctx_t *prof_tctx;
/* True if zero-filled; used by chunk recycling code. */ /* True if zero-filled; used by chunk recycling code. */
bool zeroed; bool zeroed;
}; };
};
typedef rb_tree(extent_node_t) extent_tree_t; typedef rb_tree(extent_node_t) extent_tree_t;
#endif /* JEMALLOC_H_STRUCTS */ #endif /* JEMALLOC_H_STRUCTS */