Comment 2 for bug 326149

Revision history for this message
Antti S. Lankila (alankila) wrote :

As a workaround, I have these lines in my rc.local to fix my two cores:

echo 30 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 30 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold

The default value of 95 seems tad high. I think it takes about 2 seconds here before CPU speed ramps up from idle, which is very irritating to watch. The lower the value, the faster it seems to react...

As a general rule, there should be a decent application-specific way to opt out of ondemand (while the application is running, it's forbidden to conserve CPU). I have some latency-critical applications that do not react well to the cpu scaler changing the cpu speed underneath them. The application's structure is a fixed length of computation that produces audio in the end. The timing of the calculation is carefully tuned with nanosleep to stop right before audio driver is ready to accept more data to minimize latency. Since the fixed period of computation takes variable time with ondemand jiggling the CPU frequency, it produces audio underruns.