How is the value of the maximum sampling frequency is determined by linux kernel? Why does this value change provided that perf is executed on the same machine?
When working with perf, I have noticed that the value of perf_event_max_sample_rate changes? Why? should not this value remain constant?
Linux kernel tracks of how long perf's non-maskable interrupt(NMI) handler is performing. If the sample duration exceeds a configurable threshold(perf_cpu_time_max_percent), it drops the sample rate. This allows to prevent system from hanging because it spends all of its time handling sampling process. In this case you will see the following message in kernel logs:
perf samples too long (2506 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
You can disable this throttling mechanism by setting perf_cpu_time_max_percent to 0:
sysctl -w kernel.perf_cpu_time_max_percent=0
Useful links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With