Recently I have upgraded to glibc 2.27, which is apparently supporting new CPU extensions like AVX2 and AVX512. String functions (memcpy, memcmp, etc) are now using those instructions. Unfortunately AVX2 and later is causing Intel CPUs to reduce clock, which based on benchmarks for application I'm working on, gives performance degradation. Is there any compilation switch to glibc where I can permanently disable selected CPU features, so that it will be limited to like normal AVX or SSE4.2?
The string functions in current glibc should only use cheap AVX instructions which do not require turbo licenses, for the reasons you indicate. If you know of any problematic instructions that are left, please file a bug.
According to an old bug, the perf
events to watch out for are:
cpu/event=0x28,umask=0x18,name=core_power_lvl1_turbo_license/
cpu/event=0x28,umask=0x20,name=core_power_lvl2_turbo_license/
cpu/event=0x28,umask=0x40,name=core_power_throttle/
Hopefully, you can use those to pinpoint the individual instructions.