Discussion on increasing the timer frequency in the Linux kernel to 1000Hz by default

An engineer from Google suggested increasing the timer interrupt frequency in the Linux kernel to 1000Hz by default, which would lead to an increase in task switching frequency and a reduction in time quantum in the task scheduler. Currently, the default is set to 250Hz as a compromise between performance, latency, and power consumption.

When using displays with a refresh rate of 120Hz, typical for modern PCs and mobile devices, the timing quantization error at a timer frequency of 250Hz is approximately half the frame time, reducing resource allocation efficiency and preventing optimal performance-to-power consumption ratios. At low timer frequencies, system power consumption may actually increase, as the DVFS (Dynamic Voltage and Frequency Scaling) mechanism employs a more aggressive strategy for frequency selection to avoid slowing down task execution.

There are situations when a task has already completed the desired operations requiring active computations, but the processor continues to operate at an elevated frequency due to the finite time quantum that has not yet expired. Increasing the task switching frequency can lead to reduced power consumption due to enhanced efficiency of dynamic frequency scaling (DVFS), more precise interval distribution by the task scheduler, more frequent updates of CPU load statistics, and a reduction in the time tasks spend waiting.

Another engineer from Google suggested leaving the timer frequency as it is (250Hz), as increasing the timer interrupt frequency could lead to higher power consumption on low-power devices, such as Internet of Things boards. According to his assessment, at a frequency of 1000Hz, even on devices running Android, there have been observations of a 7% increase in processor power consumption in certain scenarios. Additionally, increasing the timer frequency results in more frequent CPU wake-ups, as at 250Hz, timers set to intervals t + 1 ms, t + 2 ms, t + 3 ms, and t + 4 ms would be grouped and lead to one wake-up, whereas at 1000Hz, there would be four separate wake-ups.

The Phoronix resource conducted a performance comparison of PCs based on the AMD Ryzen 9 9950X CPU. The configuration with 1000Hz turned out to be faster in tests involving Llama.cpp, nginx, SuperTuxKart, Selenium, and measuring kernel build times. In tests with Darktable, PostgreSQL, Unvanquished, Xonotic, Blender, SVT-AV1, and RawTherapee, performance was better at a setting of 250Hz. At 1000Hz, the average power consumption was 144.2 W, the minimum was 0.18 W, and the maximum was 202.13 W; whereas at 250Hz, the average was 144.37 W, the minimum was 0.07 W, and the maximum was 202 W.

Discussion on increasing the timer frequency in the Linux kernel to 1000Hz by default


Source: opennet.ru
Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster