Commit 75ddbbfa authored by Adam Retter's avatar Adam Retter Committed by Facebook GitHub Bot

Fix cache line sizing on s390x (#1340)

Summary:
We are using Folly inside RocksDB, and we noticed a build failure due to cache line sizing on s390x. I fixed it in our copy of Folly, and am sending you the changes upstream.

CC pdillinger
Pull Request resolved: https://github.com/facebook/folly/pull/1340

Reviewed By: WillerZ

Differential Revision: D20628323

Pulled By: Orvid

fbshipit-source-id: 03ea68b023fa1fdf7fae2e283687530ab5b6ead3
parent 4ab53568
...@@ -107,11 +107,18 @@ constexpr bool kHasUnalignedAccess = false; ...@@ -107,11 +107,18 @@ constexpr bool kHasUnalignedAccess = false;
#define FOLLY_PPC64 0 #define FOLLY_PPC64 0
#endif #endif
#if defined(__s390x__)
#define FOLLY_S390X 1
#else
#define FOLLY_S390X 0
#endif
namespace folly { namespace folly {
constexpr bool kIsArchArm = FOLLY_ARM == 1; constexpr bool kIsArchArm = FOLLY_ARM == 1;
constexpr bool kIsArchAmd64 = FOLLY_X64 == 1; constexpr bool kIsArchAmd64 = FOLLY_X64 == 1;
constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1; constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1;
constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1; constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1;
constexpr bool kIsArchS390X = FOLLY_S390X == 1;
} // namespace folly } // namespace folly
namespace folly { namespace folly {
......
...@@ -120,7 +120,7 @@ struct alignas(max_align_v) max_align_t {}; ...@@ -120,7 +120,7 @@ struct alignas(max_align_v) max_align_t {};
// //
// mimic: std::hardware_destructive_interference_size, C++17 // mimic: std::hardware_destructive_interference_size, C++17
constexpr std::size_t hardware_destructive_interference_size = constexpr std::size_t hardware_destructive_interference_size =
kIsArchArm ? 64 : 128; (kIsArchArm || kIsArchS390X) ? 64 : 128;
static_assert(hardware_destructive_interference_size >= max_align_v, "math?"); static_assert(hardware_destructive_interference_size >= max_align_v, "math?");
// Memory locations within the same cache line are subject to constructive // Memory locations within the same cache line are subject to constructive
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment