30 lines
836 B
Diff
30 lines
836 B
Diff
diff --git a/sql/memory/aligned_atomic.h b/sql/memory/aligned_atomic.h
|
|
index 423366dab38..15638ed8963 100644
|
|
--- a/sql/memory/aligned_atomic.h
|
|
+++ b/sql/memory/aligned_atomic.h
|
|
@@ -81,18 +81,19 @@ static inline size_t _cache_line_size() {
|
|
static inline size_t _cache_line_size() {
|
|
long size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
|
|
if (size == -1) return 64;
|
|
-#if defined(__s390x__)
|
|
- // returns 0 on s390x RHEL 7.x
|
|
+
|
|
+ // returns 0 on some configurations
|
|
if (size == 0) {
|
|
FILE *p = fopen(
|
|
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r");
|
|
if (p) {
|
|
- fscanf(p, "%ld", &size);
|
|
+ if (fscanf(p, "%ld", &size) != 1) size = 0;
|
|
fclose(p);
|
|
}
|
|
}
|
|
-#endif
|
|
- return static_cast<size_t>(size);
|
|
+
|
|
+ if (size > 0) return static_cast<size_t>(size);
|
|
+ return 64;
|
|
}
|
|
|
|
#else
|