PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.72k stars 914 forks source link

dnsdist: Ponder using std::hardware_destructive_interference_size instead of CPU_LEVEL1_DCACHE_LINESIZE #10834

Open rgacogne opened 3 years ago

rgacogne commented 3 years ago

Short description

9998 used CPU_LEVEL1_DCACHE_LINESIZE because we were still using C++11 and std::hardware_destructive_interference_size requires C++17, but we are now using C++17 so in theory we could do better a determining the required padding size to prevent false sharing.

omoerbeek commented 3 years ago

I tried this on OpenBSD (clang 11) but it does not seem to have this symbol, even though it claims C++17 support.

omoerbeek commented 3 years ago

The test program bewlo also fails on Buster using gcc 11:

x.cc: In function ‘int main()’:
x.cc:5:21: error: ‘hardware_destructive_interference_size’ is not a member of ‘std’
    5 |   std::cout << std::hardware_destructive_interference_size << std::endl;
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <new>
#include <iostream>
int main()
{
  std::cout << std::hardware_destructive_interference_size << std::endl;
  return 0;
}