Bin: Move stats closer to the mutex.
This is a slight cache locality optimization.
This commit is contained in:
parent
c259323ab3
commit
20140629b4
@ -16,6 +16,12 @@ struct bin_s {
|
|||||||
/* All operations on bin_t fields require lock ownership. */
|
/* All operations on bin_t fields require lock ownership. */
|
||||||
malloc_mutex_t lock;
|
malloc_mutex_t lock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bin statistics. These get touched every time the lock is acquired,
|
||||||
|
* so put them close by in the hopes of getting some cache locality.
|
||||||
|
*/
|
||||||
|
bin_stats_t stats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current slab being used to service allocations of this bin's size
|
* Current slab being used to service allocations of this bin's size
|
||||||
* class. slabcur is independent of slabs_{nonfull,full}; whenever
|
* class. slabcur is independent of slabs_{nonfull,full}; whenever
|
||||||
@ -33,9 +39,6 @@ struct bin_s {
|
|||||||
|
|
||||||
/* List used to track full slabs. */
|
/* List used to track full slabs. */
|
||||||
edata_list_active_t slabs_full;
|
edata_list_active_t slabs_full;
|
||||||
|
|
||||||
/* Bin statistics. */
|
|
||||||
bin_stats_t stats;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A set of sharded bins of the same size class. */
|
/* A set of sharded bins of the same size class. */
|
||||||
|
@ -347,6 +347,13 @@ tcache_bin_flush_impl(tsd_t *tsd, tcache_t *tcache, cache_bin_t *cache_bin,
|
|||||||
cur_bin = arena_get_bin(cur_arena, binind,
|
cur_bin = arena_get_bin(cur_arena, binind,
|
||||||
cur_binshard);
|
cur_binshard);
|
||||||
assert(cur_binshard < bin_infos[binind].n_shards);
|
assert(cur_binshard < bin_infos[binind].n_shards);
|
||||||
|
/*
|
||||||
|
* If you're looking at profiles, you might think this
|
||||||
|
* is a good place to prefetch the bin stats, which are
|
||||||
|
* often a cache miss. This turns out not to be
|
||||||
|
* helpful on the workloads we've looked at, with moving
|
||||||
|
* the bin stats next to the lock seeming to do better.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (small) {
|
if (small) {
|
||||||
|
Loading…
Reference in New Issue
Block a user