Add fallback for cache line size detection
- Provide default cache line size for systems without _SC_LEVEL1_DCACHE_LINESIZE - Set default to 64 bytes, which is common on x86_64 architectures - Improve portability of cache line size detection
This commit is contained in:
@@ -127,7 +127,12 @@ void MalignBuffer::InitializeMemoryForSanitizer(char *addr, size_t size) {
|
||||
}
|
||||
|
||||
const size_t MalignBuffer::kPageSize = sysconf(_SC_PAGESIZE);
|
||||
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
|
||||
const size_t MalignBuffer::kCacheLineSize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
||||
#else
|
||||
// Default to 64 bytes which is common on x86_64
|
||||
const size_t MalignBuffer::kCacheLineSize = 64;
|
||||
#endif
|
||||
|
||||
std::string MalignBuffer::ToString(CopyMethod m) {
|
||||
switch (m) {
|
||||
|
Reference in New Issue
Block a user