From: Michael Prokop Date: Thu, 11 Dec 2014 10:29:31 +0000 (+0100) Subject: config_cpu: set ondemand governor only if available X-Git-Tag: v0.14.0~1 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=03d4320918d6ce6ac65428380e4d32ad04987f80;ds=sidebyside config_cpu: set ondemand governor only if available Nowadays we enable and use the ondemand governor by default in our kernel configuration. More recent systems providing Intel Haswell CPUs (e.g. the i7-3520M CPU as present in the Lenovo X230 laptops as well as the CPU present in IBM flex chassis) use pstates/intel_pstate and disable the ondemand governor at all, so only performance and powersave are available (unless you set intel_pstate=disable at boot time). Also see https://plus.google.com/+TheodoreTso/posts/2vEekAsG2QT Thanks to Yves-Alexis Perez for the pointer. --- diff --git a/autoconfig.functions b/autoconfig.functions index 3ab2c02..23574ef 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1028,22 +1028,22 @@ if [ -x /etc/init.d/loadcpufreq ] ; then fi fi - rm -f $LOADCPUFREQ + rm -f "$LOADCPUFREQ" if [ -z "$SKIP_CPU_GOVERNOR" ] ; then - if grep -vq ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then - einfo "Loading cpufreq_ondemand" - modprobe cpufreq_ondemand - eend $? + if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ] ; then + if ! grep -q ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ; then + einfo "Ondemand governor not available for CPU(s), not modifying governor configuration" + else + einfo "Setting ondemand governor" + RC=0 + for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do + echo ondemand > $file || RC=1 + done + eend $RC + fi fi - - einfo "Setting ondemand governor" - RC=0 - for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do - echo ondemand > $file || RC=1 - done - eend $RC - fi # cpu-governor + fi eoutdent fi