103907ee1SPatrick WilliamsFrom 5c9e0d0fc9188bab0ae09c9c33df01938b0c1b6c Mon Sep 17 00:00:00 2001 203907ee1SPatrick WilliamsFrom: Khem Raj <raj.khem@gmail.com> 303907ee1SPatrick WilliamsDate: Thu, 14 Apr 2022 09:25:33 -0700 403907ee1SPatrick WilliamsSubject: [PATCH] server: Adjust the cache alignment assumptions 503907ee1SPatrick Williams 603907ee1SPatrick Williamsaarch64 has 256 for hardware_destructive_interference_size and gcc 12 703907ee1SPatrick Williamshas added a warning to complain about mismatches which results in 803907ee1SPatrick Williamsstatic_assert failures 903907ee1SPatrick Williams 1003907ee1SPatrick WilliamsIn file included from src/mongo/s/commands/cluster_find_cmd.cpp:39: 1103907ee1SPatrick Williamssrc/mongo/db/stats/counters.h:185:47: error: static assertion failed: cache line spill 1203907ee1SPatrick Williams 185 | static_assert(sizeof(decltype(_together)) <= stdx::hardware_constructive_interference_size, 1303907ee1SPatrick Williams | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1403907ee1SPatrick Williams 1503907ee1SPatrick WilliamsThe structure need to ensure true sharing for both the elements 1603907ee1SPatrick Williamsso align it to hardware_constructive_interference_size instead 1703907ee1SPatrick Williams 18*6aa7eec5SAndrew GeisslerUpstream-Status: Inappropriate [https://jira.mongodb.org/browse/SERVER-65664] 1903907ee1SPatrick Williams 2003907ee1SPatrick WilliamsSigned-off-by: Khem Raj <raj.khem@gmail.com> 2103907ee1SPatrick Williams--- 2203907ee1SPatrick Williams src/mongo/db/stats/counters.h | 6 +++--- 2303907ee1SPatrick Williams 1 file changed, 3 insertions(+), 3 deletions(-) 2403907ee1SPatrick Williams 2503907ee1SPatrick Williams--- a/src/mongo/db/stats/counters.h 2603907ee1SPatrick Williams+++ b/src/mongo/db/stats/counters.h 2703907ee1SPatrick Williams@@ -182,8 +182,8 @@ private: 2803907ee1SPatrick Williams AtomicWord<long long> requests{0}; 2903907ee1SPatrick Williams }; 3003907ee1SPatrick Williams CacheAligned<Together> _together{}; 3103907ee1SPatrick Williams- static_assert(sizeof(decltype(_together)) <= stdx::hardware_constructive_interference_size, 3203907ee1SPatrick Williams- "cache line spill"); 3303907ee1SPatrick Williams+ static_assert(sizeof(Together) <= stdx::hardware_constructive_interference_size, 3403907ee1SPatrick Williams+ "cache line spill"); 3503907ee1SPatrick Williams 3603907ee1SPatrick Williams CacheAligned<AtomicWord<long long>> _logicalBytesOut{0}; 3703907ee1SPatrick Williams 38