Move reentrancy_level to the beginning of TSD.
This commit is contained in:
parent
b407a65401
commit
04ef218d87
@ -26,8 +26,8 @@ struct tsd_init_head_s {
|
|||||||
* t: tcache
|
* t: tcache
|
||||||
* --- data not accessed on tcache fast path: arena related fields ---
|
* --- data not accessed on tcache fast path: arena related fields ---
|
||||||
* d: arenas_tdata_bypass
|
* d: arenas_tdata_bypass
|
||||||
* r: narenas_tdata
|
* r: reentrancy_level
|
||||||
* x: blank space (1 byte)
|
* x: narenas_tdata
|
||||||
* i: iarena
|
* i: iarena
|
||||||
* a: arena
|
* a: arena
|
||||||
* o: arenas_tdata
|
* o: arenas_tdata
|
||||||
@ -36,7 +36,7 @@ struct tsd_init_head_s {
|
|||||||
* Use a compact layout to reduce cache footprint.
|
* Use a compact layout to reduce cache footprint.
|
||||||
* +--- 64-bit and 64B cacheline; 1B each letter; First byte on the left. ---+
|
* +--- 64-bit and 64B cacheline; 1B each letter; First byte on the left. ---+
|
||||||
* |---------------------------- 1st cacheline ----------------------------|
|
* |---------------------------- 1st cacheline ----------------------------|
|
||||||
* | sedxrrrr mmmmmmmm ffffffff pppppppp [c * 32 ........ ........ .......] |
|
* | sedrxxxx mmmmmmmm ffffffff pppppppp [c * 32 ........ ........ .......] |
|
||||||
* |---------------------------- 2nd cacheline ----------------------------|
|
* |---------------------------- 2nd cacheline ----------------------------|
|
||||||
* | [c * 64 ........ ........ ........ ........ ........ ........ .......] |
|
* | [c * 64 ........ ........ ........ ........ ........ ........ .......] |
|
||||||
* |---------------------------- 3nd cacheline ----------------------------|
|
* |---------------------------- 3nd cacheline ----------------------------|
|
||||||
@ -53,6 +53,7 @@ struct tsd_init_head_s {
|
|||||||
/* O(name, type, [gs]et, init, cleanup) */ \
|
/* O(name, type, [gs]et, init, cleanup) */ \
|
||||||
O(tcache_enabled, bool, yes, yes, no) \
|
O(tcache_enabled, bool, yes, yes, no) \
|
||||||
O(arenas_tdata_bypass, bool, no, no, no) \
|
O(arenas_tdata_bypass, bool, no, no, no) \
|
||||||
|
O(reentrancy_level, int8_t, no, no, no) \
|
||||||
O(narenas_tdata, uint32_t, yes, no, no) \
|
O(narenas_tdata, uint32_t, yes, no, no) \
|
||||||
O(thread_allocated, uint64_t, yes, no, no) \
|
O(thread_allocated, uint64_t, yes, no, no) \
|
||||||
O(thread_deallocated, uint64_t, yes, no, no) \
|
O(thread_deallocated, uint64_t, yes, no, no) \
|
||||||
@ -65,8 +66,7 @@ struct tsd_init_head_s {
|
|||||||
O(witnesses, witness_list_t, no, no, yes) \
|
O(witnesses, witness_list_t, no, no, yes) \
|
||||||
O(rtree_leaf_elm_witnesses, rtree_leaf_elm_witness_tsd_t, \
|
O(rtree_leaf_elm_witnesses, rtree_leaf_elm_witness_tsd_t, \
|
||||||
no, no, no) \
|
no, no, no) \
|
||||||
O(witness_fork, bool, yes, no, no) \
|
O(witness_fork, bool, yes, no, no)
|
||||||
O(reentrancy_level, int, no, no, no)
|
|
||||||
|
|
||||||
#define TSD_INITIALIZER { \
|
#define TSD_INITIALIZER { \
|
||||||
tsd_state_uninitialized, \
|
tsd_state_uninitialized, \
|
||||||
@ -75,6 +75,7 @@ struct tsd_init_head_s {
|
|||||||
0, \
|
0, \
|
||||||
0, \
|
0, \
|
||||||
0, \
|
0, \
|
||||||
|
0, \
|
||||||
NULL, \
|
NULL, \
|
||||||
RTREE_CTX_ZERO_INITIALIZER, \
|
RTREE_CTX_ZERO_INITIALIZER, \
|
||||||
NULL, \
|
NULL, \
|
||||||
@ -83,8 +84,7 @@ struct tsd_init_head_s {
|
|||||||
TCACHE_ZERO_INITIALIZER, \
|
TCACHE_ZERO_INITIALIZER, \
|
||||||
ql_head_initializer(witnesses), \
|
ql_head_initializer(witnesses), \
|
||||||
RTREE_ELM_WITNESS_TSD_INITIALIZER, \
|
RTREE_ELM_WITNESS_TSD_INITIALIZER, \
|
||||||
false, \
|
false \
|
||||||
0 \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tsd_s {
|
struct tsd_s {
|
||||||
|
@ -1958,7 +1958,7 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
|||||||
* If we're here, then arena 0 already exists, so bootstrapping
|
* If we're here, then arena 0 already exists, so bootstrapping
|
||||||
* is done enough that we should have tsd.
|
* is done enough that we should have tsd.
|
||||||
*/
|
*/
|
||||||
int *reentrancy_level = tsd_reentrancy_levelp_get(tsdn_tsd(
|
int8_t *reentrancy_level = tsd_reentrancy_levelp_get(tsdn_tsd(
|
||||||
tsdn));
|
tsdn));
|
||||||
++*reentrancy_level;
|
++*reentrancy_level;
|
||||||
hooks_arena_new_hook();
|
hooks_arena_new_hook();
|
||||||
|
@ -1662,7 +1662,7 @@ imalloc_body(static_opts_t *sopts, dynamic_opts_t *dopts) {
|
|||||||
* bother getting the old level, so we shouldn't try to reset it. This
|
* bother getting the old level, so we shouldn't try to reset it. This
|
||||||
* is indicated by leaving the pointer as NULL.
|
* is indicated by leaving the pointer as NULL.
|
||||||
*/
|
*/
|
||||||
int *reentrancy_level = NULL;
|
int8_t *reentrancy_level = NULL;
|
||||||
|
|
||||||
/* Initialize (if we can't prove we don't have to). */
|
/* Initialize (if we can't prove we don't have to). */
|
||||||
if (sopts->slow) {
|
if (sopts->slow) {
|
||||||
|
Loading…
Reference in New Issue
Block a user