align CentralFreeList on cache line size instead of just 64
We had hardcoded size alignment on 64 bytes, seemingly to avoid cacheline contention when taking per-size-class central free list locks. But it makes more sense to do platform specific alignment. I did consider std::hardware_constructive_interference_size, but practical values seem to differ from what we have configured at least on some platforms.
This commit is contained in:
parent
353816fd9d
commit
a05bab586a
|
@ -45,7 +45,7 @@
|
|||
namespace tcmalloc {
|
||||
|
||||
// Data kept per size-class in central cache.
|
||||
class alignas(64) CentralFreeList {
|
||||
class CACHELINE_ALIGNED CentralFreeList {
|
||||
public:
|
||||
constexpr CentralFreeList() {}
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ void Static::InitStaticVars() {
|
|||
span_allocator_.New(); // Reduce cache conflicts
|
||||
span_allocator_.New(); // Reduce cache conflicts
|
||||
stacktrace_allocator_.Init();
|
||||
// Do a bit of sanitizing: make sure central_cache is aligned properly
|
||||
CHECK_CONDITION((sizeof(central_cache_[0]) % 64) == 0);
|
||||
|
||||
for (int i = 0; i < num_size_classes(); ++i) {
|
||||
central_cache_[i].Init(i);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue